[R] two Y Axes (in the same scale) in ggplot2
David Winsemius
dwinsemius at comcast.net
Wed May 9 15:31:16 CEST 2012
On May 9, 2012, at 3:28 AM, Jim Lemon wrote:
> On 05/09/2012 05:29 AM, wudadan wrote:
>> Dear R users,
>>
>> I'm plotting housing prices in City A over past 30 years in
>> ggplot2. The Xs
>> are years since 1980. I have two housing price variables: new home
>> prices
>> and old home prices, both of them measured by $/sqft. I have searched
>> related threads on multiple Y axes in ggplot2 and I understand that
>> multiple
>> Y axes in different scales are not possible. I'm wondering if it is
>> possible
>> to have multiple Y axes with the same scale in ggplot2, like in my
>> case. If
>> still not possible, is there a easy way to do it in R's default plot
>> function? Thanks.
>>
> Hi Gary,
> Perhaps twoord.plot (plotrix) will do what you want.
There is also a two ordinate function in package latticeExtra for
lattice plots.
(It does not really make sense to be requesting two ordinates that are
on the same scale, or rather it would be somewhat redundant, wouldn't
it? Are you really trying to get the results that lattice plots
provide with the group parameter and base plotting provides with
lines() and points() or matplot()?)
>
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list