Displaying 14 results from an estimated 14 matches for "sec_axi".
Did you mean:
sec_axis
2017 Aug 11
2
Annotation Ticks on the axis
...uot;, scales::math_format(10^.x))
) +
scale_y_log10(
breaks = scales::trans_breaks("log10", function(x) 10^x),
labels = scales::trans_format("log10", scales::math_format(10^.x))
) +theme_bw()
p2<-p1 + annotation_logticks()
p2
p2 + scale_y_continuous(sec.axis = sec_axis(~.))
I get the following error :
Scale for 'y' is already present. Adding another scale for 'y', which will
replace the existing scale.
My questions :
1. How do I change the breaks and labels to correspond to those in my
earlier plot with R graphics? I don't want the 10^x form...
2017 Aug 11
0
Annotation Ticks on the axis
...gt; scale_y_log10(
> breaks = scales::trans_breaks("log10", function(x) 10^x),
> labels = scales::trans_format("log10", scales::math_format(10^.x))
> ) +theme_bw()
> p2<-p1 + annotation_logticks()
> p2
>
>
> p2 + scale_y_continuous(sec.axis = sec_axis(~.))
> I get the following error :
> Scale for 'y' is already present. Adding another scale for 'y', which will
> replace the existing scale.
>
StackOverflow question with extensive commentary:
Plot with 2 y axes, one y axis on the left, and another y axis on the righ...
2017 Oct 17
2
ggplot / second axis / just a notation problem
...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]]
2017 Oct 12
2
dual y-axis for ggplot
...range of the temperature
p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity"))
# now adding the secondary axis, following the example in the help file
?scale_y_continuous
# and, very important, reverting the above transformation
p <- p + scale_y_continuous(sec.axis = sec_axis(~.*5, name = "Relative
humidity [%]"))
# modifying colours and theme options
p <- p + scale_colour_manual(values = c("blue", "red"))
p <- p + labs(y = "Air temperature [?C]",
x = "Date and time",
colour...
2023 Nov 24
1
ggplot adjust two y-axis
...ers
Is it possible to adjust two y-axis in a ggplot differently?
- First y axis (0-60)
- Second y axis (0-2500)
### Figure 1
ggplot(Fig1,aes(BFF,Wert,fill=Studien_Flaeche))+
geom_bar(stat="identity",position='dodge')+
scale_y_continuous(name="First Axis", sec.axis=sec_axis(trans=~.*50,
name="Second Axis"))+
scale_fill_brewer(palette="Set1")
Thanks a lot
Sibylle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ggplot.pdf
Type: application/pdf
Size: 4806 bytes
Desc: not available
URL: <https://stat.ethz.ch/...
2023 Nov 24
1
ggplot adjust two y-axis
...ers
Is it possible to adjust two y-axis in a ggplot differently?
- First y axis (0-60)
- Second y axis (0-2500)
### Figure 1
ggplot(Fig1,aes(BFF,Wert,fill=Studien_Flaeche))+
geom_bar(stat="identity",position='dodge')+
scale_y_continuous(name="First Axis", sec.axis=sec_axis(trans=~.*50,
name="Second Axis"))+
scale_fill_brewer(palette="Set1")
Thanks a lot
Sibylle
2017 Oct 17
0
ggplot / second axis / just a notation problem
...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
>
> [[alternati...
2017 Aug 11
0
Annotation Ticks on the axis
...responding to the command annotation_logticks
> in ggplot2. Actually, it would be easiest for me to work directly with ggplot. But
> I am not able to implement the secondary axis option with ggplot. Would
> appreciate help with that, if it is easier.
http://ggplot2.tidyverse.org/reference/sec_axis.html
Cheers
Petr
>
> Thanks,
>
> Vivek
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE...
2017 Aug 11
2
Annotation Ticks on the axis
Hi all,
I would like to have help in getting annotation ticks (corresponding to the
minor grid) on my plot. Here is my toy example :
par(mar=c(5, 6, 5, 5) + 0.1)
x<-1:10
y<-x^2
plot(x,y,log="xy",xlab="log(x)",ylab="log(y)")
par(new=T)
2017 Oct 12
0
dual y-axis for ggplot
...; p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity"))
>
> # now adding the secondary axis, following the example in the help file
> ?scale_y_continuous
> # and, very important, reverting the above transformation
> p <- p + scale_y_continuous(sec.axis = sec_axis(~.*5, name = "Relative
> humidity [%]"))
>
> # modifying colours and theme options
> p <- p + scale_colour_manual(values = c("blue", "red"))
> p <- p + labs(y = "Air temperature [?C]",
> x = "Date and time&q...
2023 Nov 24
1
ggplot adjust two y-axis
...ers
Is it possible to adjust two y-axis in a ggplot differently?
- First y axis (0-60)
- Second y axis (0-2500)
### Figure 1
ggplot(Fig1,aes(BFF,Wert,fill=Studien_Flaeche))+
geom_bar(stat="identity",position='dodge')+
scale_y_continuous(name="First Axis", sec.axis=sec_axis(trans=~.*50,
name="Second Axis"))+
scale_fill_brewer(palette="Set1")
Thanks a lot
Sibylle
2017 Oct 12
1
dual y-axis for ggplot
...(aes(y = rel_hum/5, colour = "Humidity"))
> >
> > # now adding the secondary axis, following the example in the help file
> > ?scale_y_continuous
> > # and, very important, reverting the above transformation
> > p <- p + scale_y_continuous(sec.axis = sec_axis(~.*5, name = "Relative
> > humidity [%]"))
> >
> > # modifying colours and theme options
> > p <- p + scale_colour_manual(values = c("blue", "red"))
> > p <- p + labs(y = "Air temperature [?C]",
> >...
2023 Nov 24
1
ggplot adjust two y-axis
...ers
Is it possible to adjust two y-axis in a ggplot differently?
- First y axis (0-60)
- Second y axis (0-2500)
### Figure 1
ggplot(Fig1,aes(BFF,Wert,fill=Studien_Flaeche))+
geom_bar(stat="identity",position='dodge')+
scale_y_continuous(name="First Axis", sec.axis=sec_axis(trans=~.*50,
name="Second Axis"))+
scale_fill_brewer(palette="Set1")
Thanks a lot
Sibylle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot2.pdf
Type: application/pdf
Size: 4386 bytes
Desc: not available
URL: <https://stat.ethz.c...
2023 Nov 24
1
ggplot adjust two y-axis
...ers
Is it possible to adjust two y-axis in a ggplot differently?
- First y axis (0-60)
- Second y axis (0-2500)
### Figure 1
ggplot(Fig1,aes(BFF,Wert,fill=Studien_Flaeche))+
geom_bar(stat="identity",position='dodge')+
scale_y_continuous(name="First Axis", sec.axis=sec_axis(trans=~.*50,
name="Second Axis"))+
scale_fill_brewer(palette="Set1")
Thanks a lot
Sibylle