Dear R-users I would like to draw a barplot with a special y-axis. Most of my data points are in the range from -50 to 50, apart from one value that is 550. I would now like to have a y-axis from -50 to 50, then a "break" and the "rest" of the y-axis, let's say from 500 to 600. In order to make clear what I'm trying to do, I attached a figure. Is it possible to do this in R? Thanks for your help Nick _____________________________________________________________ Nicolas Schneider, PhD Student University of Bern Institute of Geography Climatology & Meteorology Hallerstrasse 12 CH-3012 Bern phone +41-31-631-8542 fax +41-31-631-8511 email schneid at giub.unibe.ch -------------- next part -------------- A non-text attachment was scrubbed... Name: axis.jpg Type: image/jpeg Size: 18949 bytes Desc: axis.jpg Url : https://stat.ethz.ch/pipermail/r-help/attachments/20020823/ea154142/axis.jpg
Nicolas Schneider wrote:> > Dear R-users > > I would like to draw a barplot with a special y-axis. Most of my data points are > in the range from -50 to 50, apart from one value that is 550. I would now like > to have a y-axis from -50 to 50, then a "break" and the "rest" of the y-axis, > let's say from 500 to 600. In order to make clear what I'm trying to do, I > attached a figure. > > Is it possible to do this in R?Not really, I think. What you can do, e.g., is that ugly trick along the following lines: barplot(c(-50, 50, 450 - 300, 50), ylim=c(-150, 200), yaxt="n") axis(2, seq(-150, 200, 50), labels = c(seq(-150, 100, 50), 450, 500)) lines(rep(par("usr")[1], 2), c(100, 150), col="white", lty="dashed") Better solutions are welcome! Uwe Ligges -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
This sort of solution has been discussed in Bill Cleveland's "The Elements of Graphing Data" (Hobart Press), and not in a very positive light I must add. Frank Harrell On Fri, 23 Aug 2002 17:46:37 +0200 (MEST) Nicolas Schneider <schneid at giub.unibe.ch> wrote:> Dear R-users > > I would like to draw a barplot with a special y-axis. Most of my data points are > in the range from -50 to 50, apart from one value that is 550. I would now like > to have a y-axis from -50 to 50, then a "break" and the "rest" of the y-axis, > let's say from 500 to 600. In order to make clear what I'm trying to do, I > attached a figure. > > Is it possible to do this in R? > > Thanks for your help > > Nick > > > _____________________________________________________________ > > Nicolas Schneider, PhD Student > University of Bern > Institute of Geography > Climatology & Meteorology > Hallerstrasse 12 > CH-3012 Bern > > phone +41-31-631-8542 > fax +41-31-631-8511 > email schneid at giub.unibe.ch >-- Frank E Harrell Jr Prof. of Biostatistics & Statistics Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences U. Virginia School of Medicine http://hesweb1.med.virginia.edu/biostat -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Nicolas Schneider wrote:> Dear R-users > > I would like to draw a barplot with a special y-axis. Most of my data > points are in the range from -50 to 50, apart from one value that is > 550. I would now like to have a y-axis from -50 to 50, then a "break" > and the "rest" of the y-axis, let's say from 500 to 600. In order to > make clear what I'm trying to do, I attached a figure. > > Is it possible to do this in R? >There is an axis.break() function in 'Kickstarting R' at: http://cran.r-project.org under "Contributed Documentation". It allows the user to place a break at any point on any axis. Jim -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._