【问题标题】:Change y-axis of ts.plot to logarithmic将 ts.plot 的 y 轴更改为对数
【发布时间】:2021-10-15 20:31:42
【问题描述】:

考虑以下代码:

library(ggplot2)

t1 <- c(1, 2, 3)
t2 <- c(4, 5, 4)
t3 <- c(7, 7, 5)
data <- data.frame(t1, t2, t3)

ts.plot(t(data), gpars = list(col = ggplot2::alpha("black", 0.5), ylim = c(0, 10),
xlim = c(0, 10), xlab = "Years", ylab = "Cumulative Numbers"))

如何将 y 轴更改为对数刻度?

【问题讨论】:

    标签: r ggplot2 plot time-series


    【解决方案1】:

    这是在起作用吗?

    ts.plot(t(data), gpars = list(col = ggplot2::alpha("black", 0.5), ylim = c(0.5, 10),
                                  xlim = c(1, 10), xlab = "Years", ylab = "Cumulative Numbers"),log = 'y')
    

    输出:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-06-26
      • 1970-01-01
      • 1970-01-01
      • 2013-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多