We’ll give you tips on How to Fix Error in plot.new() : figure margins too large. You can try the methods below to fix this error.
How to Fix Error in plot.new() : figure margins too large
The Rstudio Error in plot.new(): figure margins too large occur when the pane that is supposed to fit into your plots is too small, this simply implies that what you are trying to plot or create on Rstudio cannot fit into the allocated space or pane. In this case, the most common fix is to make adjustments to the size of the margins on the par () and also to enlarge the size/layout of the device on which the plotting is being done. In Rstudio, the par () is responsible for the creation of simple plots that are multi-panelled and the layout is usually used for designed panelled plots of different sizes.
How To Correct the Error in plot.new() : figure margins too large
The Error in plot. new (): figure margins too large could appear on your screen when you are trying to plot on Rstudio. The common problems associated with this error have to do with the layouts and par (). However, some users have confirmed that this error could also be associated with bugs and some internal hitches that can be simply fixed by restarting your device or closing the Rstudio and terminal and then restarting.
Error with Code
The most common Rstudio error is gotten when the output of par (“mar”) is  5.1 4.1 4.1 2.1 to correct this error, you should rewrite par (“mar”) as par(mar=c(1,1,1,1)). This should correct the error, If not you can change the values to corresponding ones. If the error persists, close Rstudio and restart.
Too Small Plot
The Error code also appears when the margins you are creating are too big for your plot panel in Rstudio. If this is the case, you can easily correct the error by expanding the plot so that it can be big enough to display the chart. To do this, follow the quick and easy steps below:
- If you try running the command and it brings up the error message, click on the broomstick icon on the bottom left corner of the page.
- Then you enlarge the page so that the layout will be large enough to accommodate the chart.
- Click on “Run” again.
- The chart will be displayed on the new page.
This action should fix The Error in plot.new() : figure margins too large on Rstudio if not, try the next fix.
The error could also occur if you try saving a high-resolution figure like; dpi = 300 or res = 300 on the Rstudio, to correct the error in this case, indicate the width and height of the margin. You can also try executing the command dev.off () which allows you to open a new graphics device through default settings.
The above procedures will help solve The Error in plot. new (): figure margins too large on Rstudio, regardless of the fault. The par () error and issues with the layout can be easily fixed as well as issues with bugs or small plots. However, you should ensure the procedures are followed accordingly to avoid faults and miscoding.