【问题标题】:How to specify a log scale y axis with stripplot in R?如何在 R 中使用带状图指定对数刻度 y 轴?
【发布时间】:2012-12-18 22:03:59
【问题描述】:

如何使用带有 log y 轴的 lattice 包中的 stripplot?使用plot,我可以使用参数log 并在对数刻度上指定我想要的轴。有没有办法用 stripplot 做到这一点,而不需要记录数字数据的日志,然后指定 y 轴点?

使用singer数据的示例代码:

stripplot(voice.part ~ height, data = singer, aspect = 1,
      jitter.data = TRUE, xlab = "Height (inches)")

注意。这个数据不需要是对数尺度的,我只是用它作为例子

【问题讨论】:

    标签: r lattice


    【解决方案1】:

    使用 lattice 包对绘图中的轴进行微调由 scales 参数处理(请参阅 ?xyplot 页面上的相应条目)。该参数本质上是一个列表,其中两个列表组件可以是xy,它们也是分别包含控制 x 轴和 y 轴外观的组件的列表。

    对于 x 轴上的对数刻度,请使用

    stripplot(voice.part ~ height, data = singer, aspect = 1,
          jitter.data = TRUE, xlab = "Height (inches)",
          scales = list(x = list(log = 2)))
    

    用你想要的任何日志库替换2

    【讨论】:

      猜你喜欢
      • 2011-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-16
      • 2014-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多