这两个功能有什么区别
plot(AP,xlab="Date", ylab = "Passenger numbers (1000's)",main="Air Passenger numbers from 1949 to 1961")
autoplot(AP) + labs(x ="Date", y = "Passenger numbers (1000's)", title="Air Passengers from 1949 to 1961")
答案 0 :(得分:1)
从图形数据表示的角度来看,graphics::plot
和ggplot2::autoplot
+ ggfortify
软件包之间的时间序列绘图没有太大区别。如果您将开始绘制更复杂的图(构面,多图,分组等),则差异将显而易见。至于您的问题,请参见下文:
graphics :: plot :
data(AirPassengers)
AP <- AirPassengers
plot(AP, xlab="Date", ylab = "Passenger numbers (1000's)", main = "Air Passenger data, base")
ggplot2 :: autoplot :
library(ggplot2)
library(ggfortify)
data(AirPassengers)
AP <- AirPassengers
autoplot(AP) +
labs(x ="Date", y = "Passenger numbers (1000's)", title = "Air Passengers from, ggplot2")