我想制作一个带有 2 个 y 轴的 ggplot 并控制两个 y 轴的比例。 我发现了这个:
ggplot with 2 y axes on each side and different scales
ggplot(mpg, aes(displ, hwy)) +
geom_point() +
scale_y_continuous(
"mpg (US)",
sec.axis = sec_axis(~ . * 1.20, name = "mpg (UK)")
)
我想将左 y 轴控制在 -20 到 110 之间(仅举个例子)