楼主: kaifengedu
21792 8

[问答] RStudio中画图的问题 [推广有奖]

  • 0关注
  • 18粉丝

已卖:641份资源

学科带头人

4%

还不是VIP/贵宾

-

威望
0
论坛币
1671 个
通用积分
475.1680
学术水平
85 点
热心指数
128 点
信用等级
60 点
经验
32847 点
帖子
913
精华
0
在线时间
1638 小时
注册时间
2010-2-2
最后登录
2025-12-27

楼主
kaifengedu 发表于 2014-8-4 10:34:19 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
各位好,下面代码在RStudio中画不出来图形,求帮忙,谢谢!
  1. attach(mtcars)
  2. layout(matrix(c(1,1,2,3), 2, 2, byrow = TRUE),
  3.              widths=c(3,1), heights=c(1,2))
  4. hist(wt)
  5. hist(mpg)
  6. hist(disp)
复制代码

出来的结果是



  1. > attach(mtcars)
  2. > layout(matrix(c(1,1,2,3), 2, 2, byrow = TRUE),
  3. + widths=c(3,1), heights=c(1,2))
  4. > hist(wt)
  5. Error in plot.new() : figure margins too large
  6. > hist(mpg)
  7. Error in plot.new() : figure margins too large
  8. > hist(disp)
  9. Error in plot.new() : figure margins too large
  10. >
复制代码

请问如何解决呢,在RGui里可以生成图形,没有任何问题!





二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:RStudio Studio dio stu Margins figure layout matrix Error

沙发
crystal8832 学生认证  发表于 2014-8-4 10:46:12
画布太小导致的,你把画布拖动,尽量大一些就会画出来,我用你的程序一开始也是这样,调整下就好了!
已有 1 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
kaifengedu + 1 + 1 + 1 + 1 热心帮助其他会员

总评分: 论坛币 + 1  学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

藤椅
kaifengedu 发表于 2014-8-4 10:52:15
crystal8832 发表于 2014-8-4 10:46
画布太小导致的,你把画布拖动,尽量大一些就会画出来,我用你的程序一开始也是这样,调整下就好了!
是这样的,多谢!另外我想了解一下,如果画布太小,图形在RStudio里面不能自动按比例缩小吗?

板凳
crystal8832 学生认证  发表于 2014-8-4 11:09:12
kaifengedu 发表于 2014-8-4 10:52
是这样的,多谢!另外我想了解一下,如果画布太小,图形在RStudio里面不能自动按比例缩小吗?
你可以看下这个链接,希望对你有帮助!
http://blog.sina.com.cn/s/blog_670445240101lc39.html

报纸
crystal8832 学生认证  发表于 2014-8-4 11:10:13

The message means that the margins in the figure are too large and do not leave enough space for the plot.
Try reducing the margin.Note you will need to consider what is an appropriate margin setting for each of your different panels, and fine-tune label sizes and so on.

For a totally blank panel, you might as well kill the margin completely:

op <- par(mar = rep(0, 4))
plot.new()
par(op)

地板
kaifengedu 发表于 2014-8-4 11:27:05
crystal8832 发表于 2014-8-4 11:10
The message means that the margins in the figure are too large and do not leave enough space for t ...
实在感谢您!

7
jjjaylihomwang 发表于 2015-3-10 13:45:37
已解决

8
xingyun1688 学生认证  发表于 2015-7-5 10:39:26
jjjaylihomwang 发表于 2015-3-10 13:45
已解决
大哥,怎么解决的?我在R上运行可以,可是在Rstudio上就是不行

9
yidouxunzi 发表于 2015-12-11 14:28:40
直接最大化rstudio,再画图就解决了,机智如我

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-7 03:49