【问题标题】:RStudio Error in plot.new() : figure margins too largeplot.new() 中的 RStudio 错误:图形边距太大
【发布时间】:2016-03-30 16:41:07
【问题描述】:

使用 R Studio 尝试使用 chartSeries() 绘制 xts 对象时会弹出以下错误:

plot.new() 中的错误:图边距太大

但是,当直接在 R 中绘制时,边距大小没有问题。

如何更正 R Studio 的边距大小。

注意:时间序列有超过 10,000 个观察/条目

谢谢

【问题讨论】:

标签: r plot timeserieschart


【解决方案1】:

写这三行:

graphics.off() par("mar") par(mar=c(1,1,1,1))

【讨论】:

    【解决方案2】:

    这有时会在 RStudio 中发生。为了解决它,您可以使用以下任何一种方法。

    1. 可能是您的“绘图”窗格太小。只需放大并查看。
    2. “清除所有绘图”在绘图窗格中查看。
    3. 在控制台运行“graphics.off()”看看。

    【讨论】:

      【解决方案3】:
      ####################
      #                  #
      #    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`
      

      【讨论】:

      • 如何解决,plot.new() 出错:图边距太大enter code here,
      • graphics.off() par("mar") par(mar=c(1,1,1,1)),仍然无法运行绘图(regressions_result, col = colorRampPalette(c( "darkgreen", "grey"))(10)), 在我的笔记本电脑 par("mar") [1] 7.1 5.1 6.1 3.1
      猜你喜欢
      • 2011-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-27
      • 2012-09-27
      • 2023-03-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多