我正在尝试使用 scale_x_datetime 来优化我的 x 轴。我从ggplot2 website阅读了文档,但是这个站点中的示例产生了与我得到的相同的错误:
> library(ggplot2)
> start <- ISOdate(2001, 1, 1, tz = "")
> df <- data.frame(
+ day30 = start + round(runif(100, max = 30 * 86400)),
+ day7 = start + round(runif(100, max = 7 * 86400)),
+ day = start + round(runif(100, max = 86400)),
+ hour10 = start + round(runif(100, max = 10 * 3600)),
+ hour5 = start + round(runif(100, max = 5 * 3600)),
+ hour = start + round(runif(100, max = 3600)),
+ min10 = start + round(runif(100, max = 10 * 60)),
+ min5 = start + round(runif(100, max = 5 * 60)),
+ min = start + round(runif(100, max = 60)),
+ sec10 = start + round(runif(100, max = 10)),
+ y = runif(100)
+ )
>
> last_plot() + scale_x_datetime(major = "2 weeks", minor = "1 week")
Error in continuous_scale(aesthetics, "datetime", identity, breaks = breaks, :
unused argument(s) (major = "2 weeks", minor = "1 week")
>
那么文档是否已过时或这里有什么问题?