# how to qplot two x-axis x1:Farenheit x2:Celsius

4 messages
Open this post in threaded view
|
Report Content as Inappropriate

## how to qplot two x-axis x1:Farenheit x2:Celsius

 Hi, how can i plot two different x axis in a ggplot2 qplot? I want to plot Farenheit and Celsius in one diagram. x1:Farenheit x2:Celsius kind regards, -- Jonas Stein <[hidden email]> ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|
Report Content as Inappropriate

## Re: how to qplot two x-axis x1:Farenheit x2:Celsius

 On 09/12/2012 09:29 AM, Jonas Stein wrote: > Hi, > > how can i plot two different x axis in a ggplot2 qplot? > I want to plot Farenheit and Celsius in one diagram. > x1:Farenheit x2:Celsius > Hi Jason, Here's a basic example of how to do this sort of thing. degC<-seq(-40,120,by=20) plot(degC,1:9) axis(3,at=degC*1.4+32) mtext("degF",3,line=2) Jim ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|
Report Content as Inappropriate

## Re: how to qplot two x-axis x1:Farenheit x2:Celsius

 Hello, Two corrections: 1. To convert from Celsius to Farenheit it's degC*1.8 + 32, not degC*1.4 + 32 2. The axis tick marks should be in the same _places_, but with different _labels_. degC<-seq(-40,120,by=20) plot(degC,1:9) axis(3, at=degC, labels=degC*1.8+32)  # here mtext("degF",3,line=2) To the op: according to Hadley Wickham, "It's not possible in ggplot2 because plots with multiple y scales are fundamentally flawed." See http://stackoverflow.com/questions/3099219/how-to-use-ggplot2-make-plot-with-2-y-axes-one-y-axis-on-the-left-and-anotherHope this helps, Rui Barradas Em 12-09-2012 10:11, Jim Lemon escreveu: > On 09/12/2012 09:29 AM, Jonas Stein wrote: >> Hi, >> >> how can i plot two different x axis in a ggplot2 qplot? >> I want to plot Farenheit and Celsius in one diagram. >> x1:Farenheit x2:Celsius >> > Hi Jason, > Here's a basic example of how to do this sort of thing. > > degC<-seq(-40,120,by=20) > plot(degC,1:9) > axis(3,at=degC*1.4+32) > mtext("degF",3,line=2) > > Jim > > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.