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

Hans Ekbrand hans.ekbrand at gmail.com
Fri Nov 2 00:00:53 CET 2007


On Thu, Nov 01, 2007 at 02:52:08PM -0400, John Kane wrote:
> I gave it a try with conventional plot and it does not
> look easy to get a good result.

Thanks alot John Kane!

While I see what you mean, I think your solution does a good job and
provides a basis for me to work on. If someone would recommend another
plotting function (or package) to try, I would still be interested.

> x <- "YRKE SAMHM INDM
> Ambassadör                 8.32 7.2771
> Läkare                     8.15 8.1029
> Domare                     8.14 7.5965
> Professor                  8.13 7.5618
> Advokat                    7.95 7.1876
> Pilot                      7.81 7.4380
> Verkställande.direktör     7.78 6.8361
> Forskare                   7.60 7.6630
> Civilingenjör              7.47 6.8802
> Statsråd                   7.41 6.3916 "
> 
> status <- read.table(textConnection(x), header=TRUE)
> xx1 <- c(rep(1,10))
> xx2 <- c(rep(2,10))
> 
> 
> plot(xx1, status[,2], xaxt='s', yaxt='s',
> xlim=c(.5,2.5),
>          ylim=c(min(status[,3]),max(status[,2])),
> type='p', xlab="", ylab="")
> points(xx2,status[,3])
> segments(xx1,status[,2],xx2,status[,3])
> text(xx1-.1,status[,2], labels=status[,1], cex=.6)
> text(xx2+.1, status[,3], labels=status[,1], cex=.6)

-- 
Hans Ekbrand (http://sociologi.cjb.net) <hans at sociologi.cjb.net>
Q. What is that strange attachment in this mail?
A. My digital signature, see www.gnupg.org for info on how you could
   use it to ensure that this mail is from me and has not been
   altered on the way to you.
-------------- 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/20071102/9fb264a2/attachment.bin 


More information about the R-help mailing list