【发布时间】:2020-10-27 01:31:07
【问题描述】:
所以我在以下两个df中使用了化学和降水数据:
chem_df
rain_df
我使用 ggplot() 绘制了两个数据集,为了获得 2 个轴,使用了 scale_y_continuous 的 sex.axis 函数,如下所示:
chem_rain_fig <- ggplot() +
geom_point(data = chem_df, aes(x = Date, y = Temp)) +
geom_line(data = rain_df, aes(x = Date, y = Rain)) +
scale_y_continuous(name = "Temp", sec.axis = (.~*, name = "Rain"))
但它不断将两个数据集绘制到原始 y 轴,如下所示: Graph with Issue 我只想指出,降雨数据在 0-10 厘米之间,这就是为什么它遵循第一个轴而不是第二个轴,限制为(0,10)
【问题讨论】: