如何从 RSTUDIO 的查看器窗格中清除所有图表 [英] How to clear all charts from viewer pane in RSTUDIO

查看:61
本文介绍了如何从 RSTUDIO 的查看器窗格中清除所有图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码在 Rstudio 查看器窗格中生成 5 个图

I have the following code which generates 5 plots in Rstudio Viewer Pane

library(highcharter)
library(tidyverse)

for(i in 1:5){

  highchart() %>% 
    hc_add_series(mpg, "point", hcaes(x = displ, y = cty)) %>%
    print()

}

如何用代码删除它们而不是手动删除它们?搜索论坛我尝试了以下方法:

How can i delete them with code instead on doing it manually? searching the forum i tried the following:

graphics.off()
dev.off()
while (dev.cur()>1) dev.off()
if(!is.null(dev.list())) dev.off()

但以上都没有帮助我摆脱情节我使用 Rstudio 1.1.423 和 R 3.4.3

But none of the above helps me get rid of the plots i use Rstudio 1.1.423 and R 3.4.3

谢谢拉斐尔

推荐答案

RStudio 中的查看器窗格与绘图窗格不同.graphics.off() 将关闭所有打开的图形设备,但不会对查看器窗格执行任何操作,如您所演示的.dev. 函数也与图形设备相关.

The Viewer Pane in RStudio is different from the Plots Pane. graphics.off() will close all of your open graphics devices, but won't do anything to the Viewer Pane, as you demonstrated. dev. functions also relate to graphics devices.

我不确定是否有可以清除查看器窗格的功能,但是您可以单击 RStudio 中的小扫帚图标,这样就可以了.

I'm not sure if there is a function that will clear your viewer pane, but you can click the little broom icon in RStudio and that will do the trick.

这篇关于如何从 RSTUDIO 的查看器窗格中清除所有图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆