Nicholas Edgington
2012-May-10 20:19 UTC
[R] Coloring subsets of points of a strip chart by quantiles
Hello All, I am trying to color five subsets of points in a series of vertical strip charts by quintiles using the quantile function, but I have not been able to do this successfully, nor have I been able to find an example of this online. I would like to have the "E1", "E2", and "E3" columns plotted on a single plot (containing the three strip charts). I am overlaying the strip chart over a transparent background box plot. ##OK, here's some data (This is probably an inelegant way to do this, but I'm obviously new to R): mdat <- matrix(c(round(runif(14,min=50,max=100)),round(runif(14,min=50,max=100)),round(runif(14,min=50,max=100))), nrow = 14, ncol=3, byrow=F,dimnames = list(c(seq(1,14,by=1)),c("E1", "E2", "E3"))) ; mdat <- as.data.frame(mdat) mdat E1 E2 E3 1 72 96 95 2 56 81 85 3 57 55 95 4 72 83 89 5 61 65 51 6 80 86 85 7 99 85 100 8 50 98 60 9 79 54 63 10 81 58 96 11 60 74 52 12 56 51 80 13 65 51 75 14 90 88 65 boxplot(mdat, col="transparent", main="mdat", boxwex = 0.25, ylab="Score", cex=2, cex.axis=2, cex.lab=1.5, cex.main=2, las=1, col.main="blue", col.lab="blue", col.axis="blue") stripchart(mdat,vertical=T, col="blue", method="stack", pch=21,cex=2, add=T, bg= rainbow(quantile(mdat, prob = c(.2, .4, .6, .8, 1), na.rm T),alpha=0.5)) ##Here's the plot, but I don't think that the coloring is behaving as I would like. (1) I don't think that the quantile function is getting applied to each "E1/2/3" separately. (2) I don't think that the data is getting "cut" and colored by (five) ranges that depend upon the quintiles. Any help would be appreciated. Thanks. http://r.789695.n4.nabble.com/file/n4624535/mdat.png -- View this message in context: http://r.789695.n4.nabble.com/Coloring-subsets-of-points-of-a-strip-chart-by-quantiles-tp4624535.html Sent from the R help mailing list archive at Nabble.com.
Reasonably Related Threads
- conditional weighted quintiles
- Retrieving matrix column and row names by index value
- Package "demography" - calculating quintiles of survival probabilities
- problem in fitting model in NLS function
- R: writing data from one matrix into another with keeping NA's