MagicForrest / DGVMTools

R package for processing, analysing and visualising ouput from Dynamic Global Vegetation Models (DGVMs)
GNU General Public License v3.0
26 stars 22 forks source link

Fixed NULL text.multiplier in plotTemporal #85

Closed hol430 closed 6 months ago

hol430 commented 11 months ago

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().

MagicForrest commented 10 months ago

Hey, thanks for the spot and fix. I'll make sure to merge that before the next release.