I have 2 lines i am trying to plot with a scale difference of ~100,
using this code
ggplot(TR_midday_avg, aes(x=day)) +
geom_line( aes(y=avg_conductance))+
geom_line( aes(y = avg_area_flow)) +
scale_y_continuous(
name = "sapflow",
sec.axis = sec_axis(~.*0.005, name="Second Axis")
)
It changes the second y axis scale but the avg_area_flow line still scales to the first y axis.
additionally I would prefer to have the area flow on the 1st, and conductance on the 2nd
df snippet
# A tibble: 6 × 7
day avg_radial_flow avg_area_flow avg_par avg_temp avg_vpd avg_conductance
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 103 0.610 161. 808 21.8 0.994 15138.
2 104 0.508 134. 759. 23.9 1.07 13884.
3 105 0.585 153. 890 18.2 1.71 8816.
4 106 0.511 133. 918. 17.9 0.922 16326.
5 107 0.482 124. 1055. 12.5 0.891 16999.
6 109 0.245 60.7 456. 9.38 0.652 23214.