ggplot / second axis / just a notation problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ggplot / second axis / just a notation problem

miao
Hi,

   I have a question on ggplot2 with the second axis, but I don't think one
needs to know ggplot2 package in order to answer this question.

   In this example,
https://rpubs.com/MarkusLoew/226759
   since the transformation of the second axis is given by y1=y2*5,
#####
   p <- p + scale_y_continuous(sec.axis = sec_axis(~.*5, name = "Relative
humidity [%]"))
#####
   Note  "~.*5"
   What can I do if the transformation is given by y1=y2-3 or y1=y2/5?
   Should I write "~.-3" or "~./5"?

   Thanks,

John

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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
|

Re: ggplot / second axis / just a notation problem

Eric Berger
Hi John,
Why not just try both and see which one makes sense?


On Tue, Oct 17, 2017 at 12:24 PM, John <[hidden email]> wrote:

> Hi,
>
>    I have a question on ggplot2 with the second axis, but I don't think one
> needs to know ggplot2 package in order to answer this question.
>
>    In this example,
> https://rpubs.com/MarkusLoew/226759
>    since the transformation of the second axis is given by y1=y2*5,
> #####
>    p <- p + scale_y_continuous(sec.axis = sec_axis(~.*5, name = "Relative
> humidity [%]"))
> #####
>    Note  "~.*5"
>    What can I do if the transformation is given by y1=y2-3 or y1=y2/5?
>    Should I write "~.-3" or "~./5"?
>
>    Thanks,
>
> John
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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
|

Re: ggplot / second axis / just a notation problem

miao
Yes, I did. I should have posted the results here.
"~./5" works, but  "~.-3" does not. Multiplication and division should
work; I am wondering how I should present the plus and the minus in this
context.

Thanks,

John

2017-10-17 2:47 GMT-07:00 Eric Berger <[hidden email]>:

> Hi John,
> Why not just try both and see which one makes sense?
>
>
> On Tue, Oct 17, 2017 at 12:24 PM, John <[hidden email]> wrote:
>
>> Hi,
>>
>>    I have a question on ggplot2 with the second axis, but I don't think
>> one
>> needs to know ggplot2 package in order to answer this question.
>>
>>    In this example,
>> https://rpubs.com/MarkusLoew/226759
>>    since the transformation of the second axis is given by y1=y2*5,
>> #####
>>    p <- p + scale_y_continuous(sec.axis = sec_axis(~.*5, name = "Relative
>> humidity [%]"))
>> #####
>>    Note  "~.*5"
>>    What can I do if the transformation is given by y1=y2-3 or y1=y2/5?
>>    Should I write "~.-3" or "~./5"?
>>
>>    Thanks,
>>
>> John
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.