[R] lines and legend

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Tue Jul 1 20:36:54 CEST 2003


Hi Anna,
What I often do before calling legend is reset the user-coordinates to 
the unit square. As in:

plot(x = 1:100, y = 1:100, col = "red")
par(usr = c(0, 1, 0, 1))
# now place legend in upper left hand corner
legend(x = 0.02, y = 0.98,
       legend = "test", col = "red", pch = 1)

Hope this is helpful,

Sundar


Anna H. Pryor wrote:
> Yes, I am using plot and then lines.  The legend is just not appearing.  I am 
> using the coordinates of the legend (150,4) which work on boxplot and plot.  
> I have not looked at the output of par (I don't know how to) to see if they 
> are in the region.  I assumed if they worked for plot and boxplot they would 
> also for lines.
> 
> Anna
> 
> 
> 
> 
> On Tuesday 01 July 2003 11:16, you wrote:
> 
>>I assume that you are calling 'plot' and then 'lines'.  Is the legend just
>>not appearing?  what are you using for the coordinates of the legend?  Have
>>you looked at the output from "par" to see if these values are within the
>>plot region?
>>__________________________________________________________
>>James Holtman               "What is the problem you are trying to solve?"
>>Executive Consultant  --  Office of Technology, Convergys
>>james.holtman at convergys.com
>>(513) 723-2929
>>
>>
>>
>>                      "Anna  H. Pryor"
>>                      <anna at ptolemy.arc.nas        To:       R-help mailing
>>list <r-help at stat.math.ethz.ch> a.gov>                       cc:
>>                      Sent by:                     Subject:  [R] lines and
>>legend r-help-bounces at stat.m
>>                      ath.ethz.ch
>>
>>
>>                      07/01/2003 13:45
>>
>>
>>
>>
>>
>>
>>When I am trying to put a legend on a plot where I am using "lines", R just
>>
>>ignores it.  I can do it with boxplot or plot, but just not with lines.  Am
>>I
>>doing something wrong?  Maybe I am just making a mistake?
>>
>>Anna
>>
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>




More information about the R-help mailing list