legend.test<- list(
legend = list(
colours = legend.empty$colours,
labels = legend.empty$levels,
title = expression(bold(underline('Test'))),
lwd = 0.5
),
legend = list(...
);
bitmap.type = getOption('bitmapType')
if (capabilities('cairo')) {
bitmap.type <- 'cairo';
}
# create a legend grob using defaults
legend.grob1 <- legend.grob(
legends = legend.test
);
tiff(
filename = "test.png",
type = bitmap.type,
width = 2,
height = 10,
units = 'in',
res = 800,
compression = 'lzw'
);
grid.draw(legend.grob1);
will fail. The getCharCE error message is not helpful to identify the issue. Maybe consider making the warning an error here?
Warning messages:
1: In FUN(X[[i]], ...) : 'x' is NULL so the result will be NULL
2: In FUN(X[[i]], ...) : 'x' is NULL so the result will be NULL
3: In FUN(X[[i]], ...) : 'x' is NULL so the result will be NULL
4: In FUN(X[[i]], ...) : 'x' is NULL so the result will be NULL
5: In FUN(X[[i]], ...) : 'x' is NULL so the result will be NULL
6: In FUN(X[[i]], ...) : 'x' is NULL so the result will be NULL
7: In FUN(X[[i]], ...) : 'x' is NULL so the result will be NULL
8: In FUN(X[[i]], ...) : 'x' is NULL so the result will be NULL
Error in grid.Call.graphics(C_setviewport, vp, TRUE) :
'getCharCE' must be called on a CHARSXP
Calls: grid.draw ... lapply -> FUN -> push.vp.viewport -> grid.Call.graphics
Execution halted
when
print(legend.empty)
isdue to a user error,
will fail. The
getCharCE
error message is not helpful to identify the issue. Maybe consider making the warning an error here?