[Rd] A small bug in R code of the legend function of the Graphics (PR#13350)

Arkady.Sherman at ksu.ru Arkady.Sherman at ksu.ru
Sat Nov 29 20:05:15 CET 2008


Martin Maechler wrote:
> but do.lines is never specified.  It can be FALSE (if there are no
> lines drawn) and a user can indeed set 'merge = TRUE" in such a
> situation.
> However, can you think of a situation where this was desirable?
> I think it should not have any effect in such a case
> {... but unfortunately it currently has ... yet another
>      sign that legend() is ``hopelessly over-featured'' ;-) }
> and possibly rather give a warning in such a case...
> 
> 
>     ASh> Guess that seg.len should be initialized before the condition "if (do.lines)"
> 
> not really; it means  'segment length' should not be used unless
> segments ("lines") are drawn.
> 
> Thank you for your note;  you are right that legend() is not
> entirely correct in such a border-line situation.
> 
> Regards,
> Martin Maechler, ETH Zurich

Thanks for the response.
Yes it's unusual to set merge without lines. I modified existing code and didn't pay attention
to the merge parameter and got the error "object "seg.len" not found". There was no connection
between the merge parameter and the error produced. So I modified the code and didn't unset
merge :). So it's better to gave an warning, or to set automatically merge to false if isn't needed.
	Arkady



More information about the R-devel mailing list