用2个y轴绘制,左侧一个y轴,右侧绘制另一个y轴 [英] Plot with 2 y axes, one y axis on the left, and another y axis on the right
问题描述
我需要在一个图表中显示一个显示计数和折线图的条形图,我可以单独执行这两个操作,但是当我将它们放在一起时,我会缩放第一层(即 geom_bar
)与第二层(即 geom_line
)重叠。
我可以将 geom_line
的轴向右移动吗?
<有时一个客户需要两个y尺度。给他们有缺陷的讲话通常是毫无意义的。但我确实喜欢ggplot2坚持以正确的方式做事。我相信ggplot实际上是在教育普通用户了解适当的可视化技术。
也许你可以使用faceting和scale来比较两个数据系列吗? - 例如看这里: https://github.com/hadley/ ggplot2 / wiki /对齐两页一页一页
I need to plot a bar chart showing counts and a line chart showing rate all in one chart, I can do both of them separately, but when I put them together, I scale of the first layer (i.e. the geom_bar
) is overlapped by the second layer (i.e. the geom_line
).
Can I move the axis of the geom_line
to the right?
Sometimes a client wants two y scales. Giving them the "flawed" speech is often pointless. But I do like the ggplot2 insistence on doing things the right way. I am sure that ggplot is in fact educating the average user about proper visualization techniques.
Maybe you can use faceting and scale free to compare the two data series? - e.g. look here: https://github.com/hadley/ggplot2/wiki/Align-two-plots-on-a-page
这篇关于用2个y轴绘制,左侧一个y轴,右侧绘制另一个y轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!