Dear List, can anyone tell me how to plot a discontinuous y-axis (ordinate with a -/ /- "break sign") to fit in data with a wide range without the need of logarthimic transformation? My data are distributed like this: (abscissa: 1:10) 1. vector to plot Min. 1st Qu. Median Mean 3rd Qu. Max. 4.030 5.987 6.865 19.520 16.200 88.000 2. vector to plot Min. 1st Qu. Median Mean 3rd Qu. Max. 0.000 2.112 2.620 2.976 4.303 7.030 I have just this one 88 outlier and cannot log-transform the data (reviewers want plain data). I would be glad to get help. Yours sincerely, Jobst Landgrebe -- Dr. Jobst Landgrebe Universit??t G??ttingen Abt. Biochemie 2 Heinrich-D??ker-Weg 12 37073 G??ttingen Germany ------------------------------- tel: 0551/39-5902 oder -2316 fax: 0551/39-5979 mail: jlandgr1 at gwdg.de
On Thu, 2005-11-17 at 11:40 +0100, jobst landgrebe wrote:> Dear List, > > can anyone tell me how to plot a discontinuous y-axis (ordinate > with a -/ /- "break sign") to fit in data with a wide range without the > need of logarthimic transformation? My data are distributed like this: > > (abscissa: 1:10) > > 1. vector to plot > > Min. 1st Qu. Median Mean 3rd Qu. Max. > 4.030 5.987 6.865 19.520 16.200 88.000 > > 2. vector to plot > > Min. 1st Qu. Median Mean 3rd Qu. Max. > 0.000 2.112 2.620 2.976 4.303 7.030 > > I have just this one 88 outlier and cannot log-transform the data > (reviewers want plain data). > > I would be glad to get help. > > Yours sincerely, > > Jobst LandgrebeSee this post by Jim Lemon, whose plotrix package on CRAN has an axis.break() function authored by Jim and Ben Bolker: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/56487.html HTH, Marc Schwartz
Dear Jim, thanks a lot, that did it. Jobst On Thu, Nov 17, 2005 at 10:18:01PM -0500, Jim Lemon wrote:> jobst landgrebe wrote: > >Dear List, > > > >can anyone tell me how to plot a discontinuous y-axis (ordinate > >with a -/ /- "break sign") to fit in data with a wide range without the > >need of logarthimic transformation? My data are distributed like this: > > > >(abscissa: 1:10) > > > >1. vector to plot > > > > Min. 1st Qu. Median Mean 3rd Qu. Max. > > 4.030 5.987 6.865 19.520 16.200 88.000 > > > >2. vector to plot > > > > Min. 1st Qu. Median Mean 3rd Qu. Max. > > 0.000 2.112 2.620 2.976 4.303 7.030 > > > >I have just this one 88 outlier and cannot log-transform the data > >(reviewers want plain data). > > > Have a look at axis.break in the plotrix package. Also, the function I > posted earlier (gap.barplot) could be modified to do something like this. > > Jim-- Dr. Jobst Landgrebe Universit??t G??ttingen Abt. Biochemie 2 Heinrich-D??ker-Weg 12 37073 G??ttingen Germany ------------------------------- tel: 0551/39-5902 oder -2316 fax: 0551/39-5979 mail: jlandgr1 at gwdg.de
jobst landgrebe <jlandgr1 <at> gwdg.de> writes:> > Dear List, > > can anyone tell me how to plot a discontinuous y-axis (ordinate > with a -/ /- "break sign") to fit in data with a wide range without the > need of logarthimic transformation? My data are distributed like this: > > (abscissa: 1:10) > > 1. vector to plot > > Min. 1st Qu. Median Mean 3rd Qu. Max. > 4.030 5.987 6.865 19.520 16.200 88.000 > > 2. vector to plot > > Min. 1st Qu. Median Mean 3rd Qu. Max. > 0.000 2.112 2.620 2.976 4.303 7.030 > > I have just this one 88 outlier and cannot log-transform the data > (reviewers want plain data). > > I would be glad to get help. > > Yours sincerely, > > Jobst Landgrebe >there is an axis.break() command in the plotrix package that will draw the break itself for you; however, it just draws the axis break -- you have to manipulate the axis labels etc. yourself. Here is an example (perhaps the beginning of a more automated version, although it would need some work) library(plotrix) x = runif(20) y = c(runif(18),1.5,1.8) break.bottom = 1.0 break.top = 1.4 top.size = 1.3 lab1=pretty(c(min(y),break.bottom)) lab2=pretty(c(break.top*1.1,max(y))) top.range = break.bottom*(top.size-1) top.data = max(y)-break.top rescale = function(y) { break.bottom+(y-break.top)/(top.data/top.range) } rescaled.y = rescale(y[y>break.top]) ## plot(x[y<break.bottom],y[y<break.bottom], ylim=c(min(y),break.bottom*top.size),axes=FALSE, xlab="x",ylab="y") axis(side=1) axis(side=2,at=lab1) box() axis.break(axis=2,breakpos=1.05) ## rescale top of plot points(x[y>break.top],rescaled.y) axis(side=2,at=rescale(lab2),labels=lab2)
Francisco J. Zagmutt
2005-Nov-18 01:40 UTC
[R] discontinuous y-axis (ordinate with a -/ /-)
axis.break() in the plotrix package will do that. You still have to modify the axis scale. Cheers Francisco>From: jobst landgrebe <jlandgr1 at gwdg.de> >To: r-help at stat.math.ethz.ch >Subject: [R] discontinuous y-axis (ordinate with a -/ /-) >Date: Thu, 17 Nov 2005 11:40:01 +0100 > >Dear List, > >can anyone tell me how to plot a discontinuous y-axis (ordinate >with a -/ /- "break sign") to fit in data with a wide range without the >need of logarthimic transformation? My data are distributed like this: > >(abscissa: 1:10) > >1. vector to plot > > Min. 1st Qu. Median Mean 3rd Qu. Max. > 4.030 5.987 6.865 19.520 16.200 88.000 > >2. vector to plot > > Min. 1st Qu. Median Mean 3rd Qu. Max. > 0.000 2.112 2.620 2.976 4.303 7.030 > >I have just this one 88 outlier and cannot log-transform the data >(reviewers want plain data). > >I would be glad to get help. > >Yours sincerely, > >Jobst Landgrebe > >-- >Dr. Jobst Landgrebe >Universit佷t G侖ttingen >Abt. Biochemie 2 >Heinrich-D侟ker-Weg 12 >37073 G侖ttingen >Germany >------------------------------- >tel: 0551/39-5902 oder -2316 >fax: 0551/39-5979 >mail: jlandgr1 at gwdg.de > >______________________________________________ >R-help at 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