Re: [R] break axis using plotrix

From: Jim Lemon <jim_at_bitwrit.com.au>
Date: Tue 18 Jul 2006 - 12:49:29 EST

Henrik Parn wrote:
> ...
> As you can see, I have problems adding the larger y-values - they end up
> in the wrong place in the graph. I suppose Jim's warning 'just be
> careful that the ylim= and labels= arguments match up' is relevant here,
> but I don't manage to fix it...
>
>
> Can anyone help me to plot the large y-values on the right
> placeaccording to the y-axis labeling?
> I am using R 2.3.1 and WinXp.
>
Hi Henrik,

Try this instead.

# plot small values
plot(x, meansarr, ylim=c(12, 30), axes=F, type="b", xlab="", ylab="Day") arrows(x, meansarr-searr, x, meansarr+searr, code = 3,   angle = 90, length = 0.03)
box()
# x-axis
axis(1, tck=0.01, las=1, at=1:4,

     labels=c("1998", "1999", "2002", "2003"), mgp=c(3, 0.5, 0)) # y-axis
axis(2,at=c(12, 14, 16, 18, 20, 24, 26, 28, 30),labels=c("12","14","16","18","20", "34","36","38","40")) # break axis
axis.break(2, 22, style="zigzag")
# now just add the points by subtracting the "gap" you have # used in the axis labels like gap.plot does points(x, meanslay, type="b")
# and add the error bars using the same trick arrows(x, meanslay-10-selay, x, meanslay-10+selay, code = 3,   angle = 90, length=0.03)

This seems to do the job on my Linux box. If you find that there is still a problem with Windows, email me again and I'll try it at work.

Jim



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jul 17 22:48:01 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 18 Jul 2006 - 00:16:27 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.