[R] Please help with legend command
Smith, Phil (CDC/CCID/NCIRD)
pzs6 at CDC.GOV
Tue Jul 3 18:13:28 CEST 2007
Hi R-ers:
I'm drawing a plot and have used different line types (lty) for
different race/ethnicity groups. I want a legend that explains what line
types correspond to the different race/ethnicity groups. I used the
following code:
legend( 1992 , 42 , c("Hispanic" , "non-Hispanic white (NHW)" ,
"non-Hispanic black" , "AI/AN" , "Asian" ) , lty=1:5 ,cex = .6 , bty='n'
)
Guess what? The legend "box" was so narrow that the line types that show
up in that legend box look essentially the same, because they are short.
I.e, although a line type might be a long dash followed by a short dash,
only the long dash shows up in the box. The consequence of this is that
the race/ethnic group that corresponds to the line type that is only a
long dash cannot be distinguished from the legend.
How do I stretch that legend box out so as to allow lty to draw longer
line segments?
Please reply to: pzs6 at cdc.gov
Many thanks!
Phil Smith
Centers for Disease Control and Prevention
More information about the R-help
mailing list