[R] state map question
Hi R-Help: I want to produce a map of the US with different colors for selected states. I installed the map package, and then used: library(maps) I can see that by using map( 'state' ) you get the state boundaries, also. How do I fill in different colors for the different states? I see there is a col parameter for map, but can't see how to get it to work! Please reply directly to: [EMAIL PROTECTED] Many Thanks! Phil Smith Centers for Disease Control and Prevention Atlanta [[alternative HTML version deleted]] __ R-help@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 and provide commented, minimal, self-contained, reproducible code.
[R] Please help with legend command
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: [EMAIL PROTECTED] Many thanks! Phil Smith Centers for Disease Control and Prevention __ R-help@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 and provide commented, minimal, self-contained, reproducible code.
[R] question about boxplot
Here is a question from an old guy: I want to use the boxplot function as follows: boxplot( p.prop ~ R + bins ) This command makes nice boxplot for the factor "R" crossed with the factor "bins". I am having alot of trouble getting control of the labels on the X axis. I want to control it more by specifying what the labels are, controling the 'size' of those labels (by using cex), and then control the rotation of the character strings of those labels (by using srt or crt). There is a "names" argument to boxplot, but I haven't had much luck controlling what it prints, the size of the font, and the character rotation. Can somebody enlighten me on how to do this? Please respond to my work email address: [EMAIL PROTECTED] Many thanks! Phil Smith Centers for Disease COntrol and Prevention [[alternative HTML version deleted]] __ R-help@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 and provide commented, minimal, self-contained, reproducible code.
[R] controling axes on boxplot() & thanks to ST, JvdH, & MK
Hi R-ers: I asked a question about how to control the axes on boxplot. Here is what worked: namz <- c( "R=1/Q1" , "R=0/Q1" , "R=1/Q2" , "R=0/Q2" , "R=1/Q3" , "R=0/Q3" , "R=1/Q4" , "R=0/Q4" ) boxplot( p.prop ~ R + bins , boxwex= .5 , plot = TRUE , axes = FALSE ) axis( side = 1 , at=c(1:8) , labels = namz , tick=TRUE , cex.axis = .8 , las=2 ) axis( side = 2 , at = seq(0,1,.1) , labels = seq(0,1,.1) ) My thanks to Steven Tucker, Joerg van den Hoff, and Michal Kubovy for their suggesions All the best, Phil Smith CDC -Original Message- From: Smith, Phil (CDC/CCID/NCIRD) Sent: Thu 2/22/2007 2:56 PM To: r-help@stat.math.ethz.ch Cc: Subject: question about boxplot Here is a question from an old guy: I want to use the boxplot function as follows: boxplot( p.prop ~ R + bins ) This command makes nice boxplot for the factor "R" crossed with the factor "bins". I am having alot of trouble getting control of the labels on the X axis. I want to control it more by specifying what the labels are, controling the 'size' of those labels (by using cex), and then control the rotation of the character strings of those labels (by using srt or crt). There is a "names" argument to boxplot, but I haven't had much luck controlling what it prints, the size of the font, and the character rotation. Can somebody enlighten me on how to do this? Please respond to my work email address: [EMAIL PROTECTED] Many thanks! Phil Smith Centers for Disease COntrol and Prevention [[alternative HTML version deleted]] __ R-help@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 and provide commented, minimal, self-contained, reproducible code.