3

这两个函数有什么区别

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

1 回答 1

1

从图形数据表示的角度来看,用于时间序列绘图的graphics::plotggplot2::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")

在此处输入图像描述

于 2018-09-21T19:49:27.320 回答