[R] break axis using plotrix

From: Henrik Parn <henrik.parn_at_bio.ntnu.no>
Date: Sun 16 Jul 2006 - 23:35:03 EST

Dear all,

I am trying to plot some data with differing range in y-values with type="b", adding error bars and break the y-axis into two parts, one lower part from 12 to 20, and one upper part from 34 to 40.

I have tried to follow the basic ideas from the script provided here by Jim Lemon:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/56487.html

My attempt looks like this:

```###########################
```

# x-values

x <- 1:4

# small y-values with corresponding standard errors
meansarr <- c(14.9, 18.2, 14.5, 18.3)
searr <- c(0.47, 1.27, 1.22, 0.49)

# large values

meanslay <- c(36.4, 39.0, 35.3, 38.6)
selay <- c(0.51, 0.34, 0.57, 0.40)

library(plotrix)

# 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")

# add large values to same plot

par(new=TRUE)
plot(x, meanslay, ylim=c(30, 40), type="b", xlab="", ylab="Day", axes=F) arrows(x, meanslay-selay, x, meanslay+selay, code = 3, angle = 90, length = 0.03)

```################################

```

Thanks a lot in advance!

Henrik
////

```--
************************
Henrik Pärn
Department of Biology
NTNU
7491 Trondheim
Norway

+47 735 96282 (office)
+47 909 89 255 (mobile)
+47 735 96100 (fax)

______________________________________________
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 Sun Jul 16 23:41:53 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:23 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.