[R] Question regarding legend look
murdoch.duncan at gmail.com
Wed Dec 1 18:25:46 CET 2010
On 01/12/2010 10:13 AM, Filoche wrote:
> Hi everyone.
> I have a quick question regarding the look of my legend in my plot. As you
> can see in the next figure, I have 3 series.
> However, I find rather difficult to differentiate the series 1 and 3
> according to their line type (lty). I would like to know if it was possible
> to make the line type in the legend to appear more clearly. For example, to
> give more horizontal space each side of the symbols "square" to have a
> better idea of the line type.
There is no parameter to the legend function to control this, but it is
pure R code, so you could write your own by modifying the legend() function.
If you take a look at legend, you'll see that it draws lines of length 2
(in some units) when do.lines is TRUE. Change that to a bigger number,
and you'll get longer lines. You'll also need to fiddle with the size
of the box, or the legend won't fit. (I think xbox is the variable
holding its width.)
More information about the R-help