[R] Making legend() look like my plot()
Uwe Ligges
ligges at statistik.uni-dortmund.de
Thu Nov 25 21:28:17 CET 2004
Dan Bolser wrote:
> Is this an impossible task?
>
> How about just problem 2 below, having one pch in one legend entry, but no
> pch in the second?
Please be at least a little bit patient! This is not a hotline! People
are not working 24 hours a day just to answer your questions at once -
they are answering questions on a voluntary basis!
answer 1) is not straightforward, but you might want to use one of
fillable symbols mentioned in ?points, e.g. number 21
answer 2) pch = c(1, NA) should do the trick.
legend(....., pch=c(21,NA), lwd=c(1,3), lty=c(1,3), pt.bg="white", col=1:2)
Uwe Ligges
>
>
>
> On Thu, 25 Nov 2004, Dan Bolser wrote:
>
>
>>Hello,
>>
>>I am using code like the following to create as simple plot...
>>
>>
>>
>>plot(x,y,type='b')
>>lines(lowess(x,y),lwd=3,lty=3,col=2)
>>
>>I want to add a legend which shows lines looking exactly like those used
>>in my plot, i.e. a thin black line with gaps taken up by circles (the
>>default for type='b', and a thick dashed red line with no pch at all).
>>
>>I have two problems,
>>
>>1) making the pch on the first like look like type = 'b' (gaps around pch)
>>2) surpressing a pch on for the second line
>>
>>
>>Any help with these two problems would be greatly appreciated.
>>
>>Any archive of plots and code to browse which could help me visually find
>>what I want and then copy the code?
>>
>>
>>An online user contributable database of 'graphics in R' would be
>>smashing.
>>
>>
>>How come some smart people dont just let me do something like
>>
>>legend(xpos,ypos,legend=add)
>>
>>to add a legend to the current plot for all the relevant points and lines
>>which have been added so far?
>>
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>>
>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list