[R] ggplot adjust two y-axis

sibyiie@stoeckii m@iii@g oii gmx@ch sibyiie@stoeckii m@iii@g oii gmx@ch
Fri Nov 24 11:52:20 CET 2023


Dear R-users

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/pipermail/r-help/attachments/20231124/f84b6dbc/attachment.pdf>


More information about the R-help mailing list