R中的自动绘图功能和绘图功能有什么区别

时间:2018-09-19 05:47:41

标签: r ggplot2 time-series ggfortify

这两个功能有什么区别

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") 

1 个答案:

答案 0 :(得分:1)

从图形数据表示的角度来看,graphics::plotggplot2::autoplot + ggfortify软件包之间的时间序列绘图没有太大区别。如果您将开始绘制更复杂的图(构面,多图,分组等),则差异将显而易见。至于您的问题,请参见下文:

graphics :: plot

data(AirPassengers)
AP <- AirPassengers
plot(AP, xlab="Date", ylab = "Passenger numbers (1000's)", main = "Air Passenger data, base")

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")

enter image description here