2

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.

agamesh
  • 559
  • 1
  • 10
  • 26
Geek On Acid
  • 6,330
  • 4
  • 44
  • 64

1 Answers1

3

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)))
IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • Ok, thank you, that's interesting and very simple solution. Even if I add more variables to y-axis I can still use `ylim` to scale it. It also responds well to `aspect` change. – Geek On Acid Aug 21 '12 at 18:18