[R] Can't figure out why short figure won't work

Jim Lemon jim at bitwrit.com.au
Fri Jul 26 07:34:36 CEST 2013


On 07/26/2013 08:54 AM, Frank Harrell wrote:
> I can't get the points and "a" and "b" to render correctly (they are
> squeezed into the axis) unless I make the height of the figure waste a
> lot of space. I'd appreciate any ideas. The code is below. Thanks!
>
> png('/tmp/z.png', width=480, height=100)
> par(mar=c(3,.5,1,.5))
> plot.new()
> par(usr=c(-10, 410, -.04, 1.04))
> par(mgp=c(1.5,.5,0))
> axis(1, at=seq(0, 400, by=50))
> axis(1, at=seq(0, 400, by=25), tcl=-.25, labels=FALSE)
> title(xlab='Mean Count')
> points(x, rep(-.02, length(x)))
> lines(rep(.25*1500, 2), c(-.04, .04), col='blue')
> lines(rep(.196*1500, 2), c(-.04, .04), col='blue')
> text(.25*1500, .07, 'a', col='blue')
> text(.196*1500,.07, 'b', col='blue')
> dev.off()
>
> It works if I use height=350.
>
> Frank
>
I get an error (x is missing), but I would try:

...
par(usr=c(-10,410,-0.1,1.04)
...

Jim



More information about the R-help mailing list