这两个函数有什么区别
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")
这两个函数有什么区别
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")
从图形数据表示的角度来看,用于时间序列绘图的graphics::plot
和ggplot2::autoplot
+ggfortify
包之间没有太大区别。如果您开始绘制更复杂的图(分面、多图、分组等),差异将很明显。至于你的问题,请看下面:
图形::情节:
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")