[R] Plots with Y axis split into two scales
Peter Alspach
Peter.Alspach at plantandfood.co.nz
Wed Feb 26 06:32:55 CET 2014
Another suggestion - would a square-root scale work for you?
Peter Alspach
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Jim Lemon
Sent: Wednesday, 26 February 2014 3:00 p.m.
To: David Parkhurst
Cc: r-help at r-project.org
Subject: Re: [R] Plots with Y axis split into two scales
> I have a "Y" variable with many values less than 50, and many fewer
> between 50 and 250.I'd like to plot those Y's against an X, with two
> scales on the Y axis---maybe 60% of the axis height for 0-50 and the
> top 40% for 50-250.(I can't use log(Y) because there are many zeroes,
> and that is the most desirable value.)
>
Hi David,
You can't do this with gap.plot because the scale of the ordinate stays the same over its extent. You could do it with twoord.plot, but it is probably not a good idea. twoord.plot was written to allow the viewer to "eyeball" the relationship between two variables with different metrics on a common abcissa. What you describe above is two sections of the same plot of one variable with two different scales on the same axis. This kind of defeats the whole idea of representing a variable's values in some visual metric.
Having been almost as negative as the logarithms you would need to represent your zeros, I will offer a few suggestions. If you are worried about crowding of large numbers of points in the lower portion of the plot, perhaps you could use smaller symbols (e.g. plot them with text using "." with adj=c(0.5,0)) or look at the count.overplot function in plotrix. I suppose you could use twoord.plot by breaking up the the values into two sets and adjusting the ylim on each side so that the two sets of values had a gap between them and then sticking in a "gap" style axis.break. I still don't think it would be fair to the data, and you don't want those data liberation people parading around your laboratory with pictures of helpless data being devoured by a Babbage Difference Engine.
Jim
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
The contents of this e-mail are confidential and may be ...{{dropped:14}}
More information about the R-help
mailing list