Quantcast

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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

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

Jonas Stein
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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

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

Jim Lemon
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

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

Rui Barradas
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-another

Hope 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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

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

John Kane
In reply to this post by Jonas Stein
I don't think you can with the current version of ggplot2.  

There appears to be development work on the issue but It's beyond my level of knowledge to implement the developmental programming althought it looks good.

https://groups.google.com/forum/?fromgroups=#!topic/ggplot2/mBdq01BxoKE seems to give a good idea of what has/is happening.

John Kane
Kingston ON Canada


> -----Original Message-----
> From: [hidden email]
> Sent: Wed, 12 Sep 2012 01:29:25 +0200
> To: [hidden email]
> Subject: [R] 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-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

____________________________________________________________
Publish your photos in seconds for FREE
TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if4

______________________________________________
[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.
Loading...