[R] ploting a comparison of two scores, including the labels in the plot

Hans Ekbrand hans.ekbrand at gmail.com
Tue Nov 6 08:30:06 CET 2007


On Mon, Nov 05, 2007 at 10:51:08AM -0700, Greg Snow wrote:
> Does the following do what you want (or at least start you in the correct direction)?
> 
> mydata <- data.frame( job=c("Ambassadör","Läkare","Domare",      
> "Professor","Advokat","Pilot","Verkställande direktör","Forskare",
> "Civilingenjör","Statsråd"), SAMHM= c(8.32, 8.15, 8.14, 8.13, 7.95,
>  7.81, 7.78, 7.60, 7.47, 7.41),    INDM= c( 7.2771, 8.1029, 7.5965,
>  7.5618, 7.1876, 7.4380, 6.8361, 7.6630, 6.8802, 6.3916))
> 
>      
> tmp <- c(rbind( mydata$SAMHM, mydata$INDM, NA ))
> tmp2 <- rep( c(1,2,NA), nrow(mydata) )
> 
> plot(tmp2, tmp, type='b', xlim=c(0,3), xlab='', ylab='rating')
> text(0.9, mydata$SAMHM, mydata$job, adj=1, cex=0.75)
> text(2.1, mydata$INDM, mydata$job, adj=0, cex=0.75)

Yes, definately! Thanks Greg, now I'll just increase the smallest
differences to a minimum so the labels becomes readable.

-- 
Hans Ekbrand (http://sociologi.cjb.net) <hans at sociologi.cjb.net>
A. Because it breaks the logical sequence of discussion
Q. Why is top posting bad?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20071106/e25e4cb4/attachment.bin 


More information about the R-help mailing list