[R] Making legend() look like my plot()

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri Nov 26 11:45:35 CET 2004


Dan Bolser wrote:

> On Fri, 26 Nov 2004, Martin Maechler wrote:
> 
> 
>>>>>>>"Dan" == Dan Bolser <dmb at mrc-dunn.cam.ac.uk>
>>>>>>>    on Thu, 25 Nov 2004 22:35:22 +0000 (GMT) writes:
>>
>>   Dan> On Thu, 25 Nov 2004, Uwe Ligges wrote:
>>   >> 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)
>>
>>   Dan> Ahhh... I tried pch=c(1,NULL), pt.bg='white' 
>>   Dan> I couldn't work out what was going on..
>>
>>hmm, really,... at least you could have tried to see  what
>>c(1,NULL) is, by just "typing it at the prompt" !
> 
> 
> Too long at the SQL prompt made me think it was immutably correct.
> 
> That and the fact that c(1,'') was making both pch dissapear made me think
> the whole thing was messed up.
> 
> 
> How come legend isn't ablt to auto detect the line types in my plot and
> add them automatically?
> 
> Is this just an issue of 'that would be cool if I had time', or is it more
> fundamental?

It is really fundamental!
[Maybe not that fundamental for lattice as for base graphics.]

Uwe Ligges



> Cheers,
> Dan.
> 
> 
> 
>>Martin
>>
> 
> 
> ______________________________________________
> 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