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

目录

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

#问题

#解决

完整错误:


#问题

拟合回归模型并计算每一个样本的dfbetas值,最佳dfbetas阈值,最后可视化每个样本对每个预测变量的影响程度;

#fit a regression model
model <- lm(mpg~disp+hp, data=mtcars)#view model summary
summary(model)#calculate DFBETAS for each observation in the model
dfbetas <- as.data.frame(dfbetas(model))#display DFBETAS for each observation
dfbetas#find number of observations
n <- nrow(mtcars)#calculate DFBETAS threshold value
thresh <- 2/sqrt(n)thresh#specify 2 rows and 1 column in plotting region#dev.off()
#par(mar = c(1, 1, 1, 1))par(mfrow=c(2,1))#plot DFBETAS for disp with threshold lines
plot(dfbetas$disp, type='h')
abline(h = thresh, lty = 2)
abline(h = -thresh, lty = 2)#plot DFBETAS for hp with threshold lines
plot(dfbetas$hp, type='h')
abline(h = thresh, lty = 2)
abline(h = -thresh, lty = 2)

#解决

par(mar = c(1, 1, 1, 1))

#fit a regression model
model <- lm(mpg~disp+hp, data=mtcars)#view model summary
summary(model)#calculate DFBETAS for each observation in the model
dfbetas <- as.data.frame(dfbetas(model))#display DFBETAS for each observation
dfbetas#find number of observations
n <- nrow(mtcars)#calculate DFBETAS threshold value
thresh <- 2/sqrt(n)thresh#specify 2 rows and 1 column in plotting region#dev.off()
par(mar = c(1, 1, 1, 1))par(mfrow=c(2,1))#plot DFBETAS for disp with threshold lines
plot(dfbetas$disp, type='h')
abline(h = thresh, lty = 2)
abline(h = -thresh, lty = 2)#plot DFBETAS for hp with threshold lines
plot(dfbetas$hp, type='h')
abline(h = thresh, lty = 2)
abline(h = -thresh, lty = 2)

完整错误:

> par(mfrow=c(2,1))

> #plot DFBETAS for disp with threshold lines
> plot(dfbetas$disp, type='h')
Error in plot.new() : figure margins too large
> abline(h = thresh, lty = 2)
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) : 
  plot.new has not been called yet
> abline(h = -thresh, lty = 2)
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) : 
  plot.new has not been called yet

> #plot DFBETAS for hp with threshold lines 
> plot(dfbetas$hp, type='h')
Error in plot.new() : figure margins too large
> abline(h = thresh, lty = 2)
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) : 
  plot.new has not been called yet
> abline(h = -thresh, lty = 2)
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) : 
  plot.new has not been called yet

参考:R

参考:How to Calculate DFBETAS in R

参考:How to Fix: error in plot.new() : figure margins too large

参考:Error in plot.new() : figure margins too large, Scatter plot

Error in plot.new() : figure margins too large相关推荐

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

    Error in plot.new(): figure margins too large 目录 Error in plot.new(): figure margins too large 问题: 解 ...

  2. R语言错误 --> Error in plot.new() : figure margins too large

    [问题描述] 在RStudio中运行R命令绘图时,出现如下错误: Error in plot.new() : figure margins too large [解决办法] 在绘图命令前,加上一句代码 ...

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

    在RStudio中使用plot()函数进行画图时,常出现"plot.new() : figure margins too large"问题.如图(1)所示. 出现该问题的原因是,R ...

  4. R绘图: figure margins too large错误

    最近在研究分类器,鸢尾花数据用得审美疲劳了,就从网上找了一个breast-cancer-wisconsin数据集. 建模前照例是做一些描述性统计,看下样本特征.数据集有9个自变量,1个因变量标签,先简 ...

  5. r语言 figure margins too large

    r语言错误如下图(数字边距太大) 解决方法:点plots界面的扫帚清空图像

  6. mysql错误码1709_MySQL5.6出现ERROR 1709 (HY000): Index column size too large问题的解决方法...

    一.问题 mysql 5.6 出现如下问题: [ERROR 1709 (HY000): Index column size too large. The maximum column size is ...

  7. r语言报错|Error in plot.window(...) : ‘xlim‘值不能是无限的

    plot()绘制图层时报错 错误提示: Error in plot.window(...) : 'xlim'值不能是无限的 In addition: Warning messages: 1: In m ...

  8. 【r语言plot报错】Error in plot.window(...) : ‘xlim‘值不能是无限的/ need finite ‘xlim’ values

    使用r语言plot函数绘图时,遇到[Error in plot.window(-) : 'xlim'值不能是无限的(need finite 'xlim' values)]的报错. 其中x轴为字符串序列 ...

  9. matplotlib基础函数函数 plot, figure

    matplotlib.pyplot.plot(*args, scalex=True, scaley=True,data=None,**kwargs) 用线段和标记去绘制x和y.调用签名: plot([ ...

最新文章

  1. 微软无解!Win10用户突然减少:装回Win7
  2. 修改Eclipse中项目在Apache Tomcat中的部署路径
  3. cython安装ubuntu_ubuntu上的Cython独立可执行文件
  4. 583. 两个字符串的删除操作用时6ms的另类解法
  5. [转]Vector、ArrayList和hashtable hashmap数据结构
  6. 华为鸿蒙2.0安装包,华为鸿蒙2.0系统安装包
  7. 复旦大学《高等代数学习指导书(第三版)》前言
  8. 自己组装电脑后怎么装Win10系统教学
  9. 旷视科技科创板IPO上会在即,毫不吝啬研发投入
  10. NEFU锐格实验一[字符串]
  11. 使用OpenKE预训练的freebase关系向量
  12. VaR的应用:选择5家上市商业银行的股票交易致据(最近3年)使用 Weibull分布法估计其90天周期95%置信水平的VaR序列,并面出VaR时序图,计算每支股票最近3年内肤幅超过VaR预测园值的次
  13. 同步多个 git 远程仓库
  14. 【C语言】计算个位十位百位思路
  15. MySQL基础知识点集合
  16. OSAL 之功耗管理
  17. sojson JS 逆向二 (免费版)
  18. 嵌入式硬件抽象层HAL的设计实现
  19. javascript-解析xml文件-在html中实现二级联动分析及案例
  20. 如何进行服务器备份操作系统,如何进行服务器备份操作系统

热门文章

  1. JavaScript的主要功能
  2. 基于ECS部署LAMP环境搭建Drupal网站,云计算技术与应用报告
  3. Ubuntu16.04下配置最新Vs Code的C/C++开发环境
  4. go语言中的类型转换
  5. 19元素的显示与隐藏
  6. html完成横纵坐标位置确定,2018-2019学年安徽省合肥市七年级下期中数学试卷-附详细答案...
  7. python处理csv文件缺失值_python处理数据中缺失值
  8. RfD-Net:基于语义实例重构的点云场景理解(CVPR2021)
  9. 用于机器人导航辅助的6自由度姿态估计的平面辅助视觉惯性里程计
  10. JAVscript对象