riatelab/mapsf

mf_symb partially fails with a column having only one value

jllipatz opened this issue · 1 comments

Hello,

When you try to do a mf_symb analysis with a column wich takes only one value, the process fails when trying to draw the legend. Graphic is drawn but not the legend and an error occurs.

> library(mapsf)
> mtq <- mapsf::mf_get_mtq()
> 
> mtq$zzz <- 1
> mf_symb(mtq, var = "zzz", add = FALSE)
Erreur dans ytop[i] <- ybottom[i - 1] - inset : 
  l'argument de remplacement est de longueur nulle

The problem disappears if you add leg_pos='n'.

About this last parameter could I suggest adding another syntax like leg_pos=NA, since if you don't want a legend it is rather normal that it has no position and R usually says that with NULL or NA ?

Best regards

Jean-Luc LIPATZ

Thank you for raising this issue. I'll have a look into it.

About the leg_pos arg, it already works as expected with NA. It is just not documented, I'll replace mentions of leg_pos = "n" with leg_pos = NA.