Passing NULL for text.multiplier into plotTemporal() results in this error:
Error in check.length(gparname) :
'gpar' element 'fontsize' must not be length 0
This seems to be caused by calling if(!missing(text.multiplier)) instead of if(!is.null(text.multiplier)) in plotTemporal. If NULL is manually passed in, missing() will return FALSE, and cause the theme$text$size to be set to NULL.
In my case, this happened when I created a wrapper function with a text.multiplier argument (defaulting to NULL), which gets passed into plotTemporal().
An easy fix is to call is.null() instead of missing().
Passing NULL for text.multiplier into plotTemporal() results in this error:
This seems to be caused by calling
if(!missing(text.multiplier))
instead ofif(!is.null(text.multiplier))
in plotTemporal. If NULL is manually passed in,missing()
will return FALSE, and cause the theme$text$size to be set to NULL.In my case, this happened when I created a wrapper function with a text.multiplier argument (defaulting to NULL), which gets passed into plotTemporal().
An easy fix is to call
is.null()
instead ofmissing()
.