尝试使用 chartSeries() 绘制 xts 对象时使用 R Studio会弹出以下错误:
plot.new() 中的错误:图形边距太大
但是,当直接在 R中绘制时,边距大小没有问题。
如何更正 R Studio 的边距大小。
注意:时间序列有超过 10,000 个观测值/条目
谢谢
尝试使用 chartSeries() 绘制 xts 对象时使用 R Studio会弹出以下错误:
plot.new() 中的错误:图形边距太大
但是,当直接在 R中绘制时,边距大小没有问题。
如何更正 R Studio 的边距大小。
注意:时间序列有超过 10,000 个观测值/条目
谢谢
写这三行:
graphics.off()
par("mar")
par(mar=c(1,1,1,1))
这有时会在 RStudio 中发生。为了解决它,您可以使用以下任何一种方法。
####################
# #
# Exercise 1 #
# #
####################
auto <- read.csv("D:/forecasting-tutorial/vehicle.csv")
plot(auto$sales,
type = "n",
ylim = c(0, 5000),
ylab = "Sales, '000 units",
xlab = "Period",
main = "US light vehicle sales in 1976-2016")
lines(auto$sales)
#plot of chunk forecasting-part-4
####################
# #
# Exercise 2 #
# #
####################
auto$trend <- seq(1:nrow(auto))
auto$income_lag <- c(NA, auto$income[1:nrow(auto)-1])
auto$unemp_lag <- c(NA, auto$unemp[1:nrow(auto)-1])
auto$rate_lag <- c(NA, auto$rate[1:nrow(auto)-1])
####################
# #
# Exercise 3 #
# #
####################
regressions_result <- regsubsets(sales ~ ., data = auto)
plot(regressions_result, col = colorRampPalette(c("darkgreen", "grey"))(10))
plot(regressions_result, col = colorRampPalette(c("darkgreen", "grey"))(10))
Error in plot.new() : figure margins too large`enter code here`