Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RStudio Error in plot.new() : figure margins too large

Using R Studio when trying to plot an xts object using chartSeries() the following error pop's up:

Error in plot.new() : figure margins too large

However when plotting it directly in R there is no problem with the margins size.

How can I correct the margins size for R Studio.

Note: the time series has more than 10,000 observations/entries

Thanks

like image 444
Daniel Avatar asked Dec 05 '22 18:12

Daniel


2 Answers

write this three lines:

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

like image 136
Hiren Avatar answered Dec 31 '22 12:12

Hiren


This sometimes happens in RStudio. In order to solve it you can use any one of the following approach.

  1. May be your "Plots" pane is too small. Just zoom it and see.
  2. "Clear All Plots" in Plots pane and see.
  3. Run "graphics.off()" in the console and see.
like image 42
Mahan Avatar answered Dec 31 '22 13:12

Mahan