将 ts.plot 的 y 轴更改为对数
Change y-axis of ts.plot to logarithmic
考虑以下代码:
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 轴更改为对数刻度?
这样做有用吗?
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')
输出:
考虑以下代码:
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 轴更改为对数刻度?
这样做有用吗?
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')
输出: