如何利用ggplot2画双坐标轴曲线

2024-12-29 02:42:19
推荐回答(1个)
回答1:

有一个坏消息
It's not possible in ggplot2 because I believe plots with separate y scales (not y-scales that are transformations of each other) are fundamentally flawed. Some problems:
The are not invertible: given a point on the plot space, you can not uniquely map it back to a point in the data space.
They are relatively hard to read correctly compared to other options. See A Study on Dual-Scale Data Charts by Petra Isenberg, Anastasia Bezerianos, Pierre Dragicevic, and Jean-Daniel Fekete for details.
They are easily manipulated to mislead: there is no unique way to specify the relative scales of the axes, leaving them open to manipulation. Two examples from the Junkcharts blog: one, two
They are arbitrary: why have only 2 scales, not 3, 4 or ten?
You also might want to read Stephen Few's lengthy discussion on the topic Dual-Scaled Axes in Graphs Are They Ever the Best Solution?.