Question

I created a simple Dotplot() using this data:

d <- data.frame(emot=rep(c("happy","angry"),each=2), 
           exp=rep(c("exp","non-exp"),2), accuracy=c(0.477,0.587,0.659,0.736), 
           Lo=c(0.4508,0.564,0.641,0.719), Hi=c(0.504,0.611,0.677,0.753))

and the code below:

library(Hmisc)
Dotplot(emot ~ Cbind(accuracy, Lo, Hi), groups=exp, data=d, 
        pch=c(1,16), aspect = "xy", par.settings = list(dot.line=list(col=0)))

enter image description here

What I want to do is to DECREASE the distance between y-axis ticks and decrease the distance between plot elements as well - so that happy/angry horizontal error lines will get closer to each other. I know I could probably achieve that by playing with scales=list(...) parameters (not sure how yet), but I would have to define labels again, etc. Is there a quicker way to do it? It seems like such a simple thing to solve, but I'm stuck.

Was it helpful?

Solution

Despite the fact that Hmisc ::Dotplot is using lattice, just adding a ylim argument seems to do the trick.You can figure out the default scale since those two values were factors with underlying 1/2 values:

Dotplot(emot ~ Cbind(accuracy, Lo, Hi), groups=exp, data=d, ylim=c(0,3),
         pch=c(1,16), aspect = "xy", par.settings = list(dot.line=list(col=0)))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top