【问题标题】:Line Plot in R with two y-axes using twoord.plot: Values of first y-axis missing使用 twoord.plot 在 R 中使用两个 y 轴绘制线图:缺少第一个 y 轴的值
【发布时间】:2021-12-30 13:25:49
【问题描述】:

我想使用以下代码创建具有两个不同 y 轴的图:

twoord.plot(lx = stack_question$year, ly = stack_question$size, ry =stack_question$density , rx = stack_question$year)

但是,左侧的 y 轴缺少值。解决该问题的最佳方法是什么?

我的数据集如下所示。

 year size    density
1 1975  144 0.06116022
2 1980  164 0.10030097
3 1985  168 0.11203907
4 1990  171 0.14876726
5 1995  173 0.15874613
6 2000  192 0.21369396
7 2005  193 0.23662855
8 2010  195 0.29243307
9 2015  196 0.30810454

非常感谢!

【问题讨论】:

    标签: r ggplot2 plot data-visualization


    【解决方案1】:

    尝试为左斧添加限制:

    lylim=c(100,200)
    

    【讨论】:

      猜你喜欢
      • 2015-04-04
      • 2016-03-10
      • 2021-11-13
      • 1970-01-01
      • 1970-01-01
      • 2016-10-27
      • 2015-10-17
      • 2020-12-14
      • 2023-03-15
      相关资源
      最近更新 更多