The "plot.new (): Figure margins too large" issue often occurs when plotting using the plot () function in Rstudio. (1) is shown.
The problem occurs because the "plots" window in the Rstudio is too small to fit properly, or to set the Rstudio to full screen. The steps to resolve are as follows.
1. Select the "Plots" tab with the mouse, and then drag the window a little larger, as shown in (2).
Figure (2) Drag the "Plots" window large
2. Test code
Data source Drink.txt
IndexHeat caffeine Na Price1 207.2 3.3 15.5 2.82 36.8 5.9 12.9 3.33 72.2 7.3 8.2 2.44 36.7 0.4 10.5 4.05 121.7 4.1 9.2 3.56 89.1 4.0 10.2 3.37 146.7 4.3 9.7 1.88 57.6 2.2 13.6 2.19 95.9 0.0 8.5 1.3Ten 199.0 0.0 10.6 3.5 One 49.8 8.0 6.3 3.7 A 16.6 4.7 6.3 1.5 - 38.5 3.7 7.7 2.0 - 0.0 4.2 13.1 2.2 the 118.8 4.7 7.2 4.1 - 107.0 0.0 8.3 4.2
Ceshi. R
Drink <-Read. Table ("G:/myproject/rdoc/unit3/rchap1/drink.txt", Header = T) drink <-drink[,-1]d=dist (drink) hc1=hclust (d,method="Ward. D2 ")#离差平方和法Hc2=hclust (d,method="single")#最短距离法Hc3=hclust (d,method="Complete")#最长距离法Hc4=hclust (d,method="Median")#中间距离法Opar=par (Mfrow=c (2,2))#分割绘图区域Plot (hc1,hang=-1);p Lot (hc2,hang=-1);p Lot (hc3,hang=-1);p Lot (hc4,hang=-1) par (OPAR)#释放绘图区域分割
The effect is as follows:
Figure (3) after the "Plots" window is enlarged, the effect of drawing is
Solve the problem of "plot.new (): Figure margins too large" in Rstudio