Andres LaCortadora
2012-Oct-11 13:48 UTC
[R] dotplot in ".R" with lattice & latticeExtra: proper visualization
Dear everyone, I'm trying to do a dotplot with the libraries "lattice" and "latticeExtra". However, no proper representation of the values on the vertical y-axis is done by ".R". Instead of choosing the actual values of the numeric variable, ".R" plots the rank of the value. That is, there are values [375, 500, 625, 750, ..., 3000] and ".R" plots their ranks [1,2,3,4,...23] and chooses the scale accordingly. Has someone experienced a problem like this? How can I manage the get a proper representation with ticks like (0, 500, 1000, 1500, ...) on the vertical y-scale? Here's my data: https://www.dropbox.com/s/egy25cj00rhum40/data.csv And here the program code so far: df.dose <- read.table("data.csv", sep=",", header=TRUE) library(lattice); library(latticeExtra) useOuterStrips(dotplot(z ~ sample.size | as.factor(effect.size)*as.factor(true.dose), groups=as.factor(type), data=df.dose, as.table=TRUE)) I'd be glad for any kind of help! Andres ----- Andres -- View this message in context: http://r.789695.n4.nabble.com/dotplot-in-R-with-lattice-latticeExtra-proper-visualization-tp4645850.html Sent from the R help mailing list archive at Nabble.com.
David Winsemius
2012-Oct-11 15:38 UTC
[R] dotplot in ".R" with lattice & latticeExtra: proper visualization
On Oct 11, 2012, at 6:48 AM, Andres LaCortadora wrote:> Dear everyone, > > I'm trying to do a dotplot with the libraries "lattice" and "latticeExtra". > However, no proper representation of the values on the vertical y-axis is > done by ".R". Instead of choosing the actual values of the numeric variable, > ".R" plots the rank of the value. That is, there are values [375, 500, 625, > 750, ..., 3000] and ".R" plots their ranks [1,2,3,4,...23] and chooses the > scale accordingly. Has someone experienced a problem like this? How can I > manage the get a proper representation with ticks like (0, 500, 1000, 1500, > ...) on the vertical y-scale? >I suspect it will be difficult with dotplot. It is expecting a factor variable for the y-value and appears to be coercing the LHS argument to one. Why not use xyplot if you are plotting numeric by numeric? If you what to add horizontal lines `ala` dotplot you could construct a panel that had the appropriate commands. -- David.> Here's my data: > https://www.dropbox.com/s/egy25cj00rhum40/data.csv > > And here the program code so far: > > df.dose <- read.table("data.csv", sep=",", header=TRUE) > library(lattice); library(latticeExtra) > > useOuterStrips(dotplot(z ~ sample.size | > as.factor(effect.size)*as.factor(true.dose), > groups=as.factor(type), data=df.dose, as.table=TRUE)) > > I'd be glad for any kind of help! > Andres >David Winsemius, MD Alameda, CA, USA