解决RStudio中"plot.new() : figure margins too large"问题

  在RStudio中使用plot()函数进行画图时,常出现“plot.new() : figure margins too large”问题。如图(1)所示。

  出现该问题的原因是,RStudio里的【Plots】窗口太小,可以适当调大一点,或者把RStudio设置为全屏。解决步骤如下。

  1.用鼠标选中【Plots】选项卡,然后把该窗口拖大一点即可,如图(2)所示。

   图(2) 将【Plots】窗口拖大

  2. 测试代码

  //数据源 drink.txt  

index   heat    caffeine    Na  price
1   207.2   3.3 15.5    2.8
2   36.8    5.9 12.9    3.3
3   72.2    7.3 8.2 2.4
4   36.7    0.4 10.5    4.0
5   121.7   4.1 9.2 3.5
6   89.1    4.0 10.2    3.3
7   146.7   4.3 9.7 1.8
8   57.6    2.2 13.6    2.1
9   95.9    0.0 8.5 1.3
10  199.0   0.0 10.6    3.5
11  49.8    8.0 6.3 3.7
12  16.6    4.7 6.3 1.5
13  38.5    3.7 7.7 2.0
14  0.0 4.2 13.1    2.2
15  118.8   4.7 7.2 4.1
16  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);plot(hc2,hang=-1);plot(hc3,hang=-1);plot(hc4,hang=-1)
par(opar)  #释放绘图区域分割

  效果如下:

图(3)将【Plots】窗口放大之后,进行绘图的效果

时间: 2024-08-29 22:39:36

解决RStudio中"plot.new() : figure margins too large"问题的相关文章

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

一页多图 par("mar")par(mar = c(1, 1.5, 1, 0.5), bg = "white")pay=c(11,19,14,22,14,28,13,81,12,43,11,16,31,16,23.42,22,26,17,22,13,27,180,16,43,82,14,11,51,76,28,66,29,14,14,65,37,16,37,35,39,27,14,17,13,38,28,40,85,32,25,26,16,12,54,40,18,

figure margins too large错误解决

使用Rstudio,遇到下面这个错误: figure margins too large 这是因为界面右下角的"plot"窗口太小,显示不了,将右下角的窗口调大就能解决

Matlab中plot函数全功能解析

Matlab中plot函数全功能解析 功能 二维曲线绘图 语法 plot(Y)plot(X1,Y1,...)plot(X1,Y1,LineSpec,...)plot(...,'PropertyName',PropertyValue,...)plot(axes_handle,...)h = plot(...)hlines = plot('v6',...) 描述 plot(Y)如果Y是m×n的数组,以1:m为X横坐标,Y中的每一列元素为Y坐标,绘制n条曲线:如果Y是n×1或者1×n的向量,则以1:n

解决gnuplot中&#39;Terminal type set to &#39;unknown&#39;不能显示绘图的问题

安装gnuplot: sudo apt-get install gnuplot 安装成功后,在终端输入gnuplot,进入gnuplot. 直接进行一个小测试: plot sin(x) 发现不能显示绘制的图.其实,原因是出现了'Terminal type set to 'unknown'这样的问题. 往上翻看安装过程中出现的提示,可以发现gnuplot还要基于gnuplot-x11或gnuplot-qt工作.于是安装gnuplot-x11: sudo apt-get install gnuplo

【原创】Matlab中plot函数全功能解析

[原创]Matlab中plot函数全功能解析 该帖由Matlab技术论(http://www.matlabsky.com)坛原创,更多精彩内容参见http://www.matlabsky.com 功能 二维曲线绘图 语法 plot(Y)plot(X1,Y1,...)plot(X1,Y1,LineSpec,...)plot(...,'PropertyName',PropertyValue,...)plot(axes_handle,...)h = plot(...)hlines = plot('v6

解决myeclipse中struts2 bug问题包的替换问题

因为struts2的bug问题,手工替换还是比较麻烦,但即便是最新的myeclipse2014也没有替换最新的struts2包,研究了一天,终于找到了解决办法.以下就解决方法与大家分享一下. 1.在perferences中找到 Myeclipse->Project Libraries,右边找到 struts2.1 Libraries,点击 Enable advanced configiguration,去掉以下文件前面的对勾,然后点击 Add custom Jars 2.在弹出的对话框中选择 A

解决VNC中tab键无效的方法

http://ubuntuforums.org/archive/index.php/t-1771058.html I accidentally discovered a fix for this while trying to solve a different problem.edit~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xmlfind the line <property name="&l

解决Eclipse中C++代码显示Symbol &amp;#39;std&amp;#39; could not be resolved的问题

第一次在Eclipse中写C++代码,写了一个简单的hello world程序,还没有等我编译.就报出了各种错误,但是这么简单的代码.怎么可能这么多错误.于是没有理会.编译执行后,能够正常输出!!!Hello World!!!,但是我的代码中还是有非常多红叉,把鼠标放在上面显示:Symbol 'std' could not be resolved 这种信息. 于是问题来了.怎样解决? 方法:写完库函数以后立刻保存.这样写之后的代码就不会报错了 比如:-->首先写#include <iostre

解决Android中No resource found that matches android:TextAppearance.Material.Widget.Button.Inverse问题

解决Android中No resource found that matches android:TextAppearance.Material.Widget.Button.Inverse问题http://blog.csdn.net/u012336923/article/details/48289485 /路径/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/values-v23/v