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
y-axis with "break"
5 messages · Nicolas Schneider, Uwe Ligges, Ben Bolker +2 more
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I don't have anything better than Uwe suggested, but I did write an "axis.break()" function at one point that inserts the actual break in the axis -- let me know if you want it. Ben Bolker
On Fri, 23 Aug 2002, Uwe Ligges wrote:
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._