如何在R中工作在Ubuntu中复制图? [英] How to copy plots in R when working in Ubuntu?

查看:137
本文介绍了如何在R中工作在Ubuntu中复制图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu上使用最新的R。在我创建了一些
图,光标变成一个+,不会让我访问
复制和粘贴选项。此外,不像Windows中的R,它
没有一个工具栏有'复制'选项。

解决方案

/ div>

在Linux下使用R时的默认图形设备是X11:基本上,它创建了一个窗口,您可以在其中看到您的绘图。



这是一个非常基本的窗口没有许多功能,所以答案是:你不能从它复制/粘贴。相反,您需要创建一个不同的图形设备,并写入绘图。大多数人会选择像PNG文件,像这样:

  png(file =myplot.png)#create PNG设备
plot(x)#做绘图
dev.off()#返回默认设备(X11)

现在您在当前目录中有一个名为myplot.png的PNG文件。


I am working on the most recent of R on Ubuntu. After I created some plots, the cursor became a '+' and won't let me access the copy and paste options. Moreover unlike the R in Windows, it does not have a toolbar that have the 'Copy' option. What can I do to copy my plots?

Thank you.

解决方案

The default graphics device when using R under Linux is something called "X11": basically, it creates the window in which you see your plot.

It's a very basic window without many features so the answer is: you can't copy/paste from it. Instead, you need to create a different graphics device and write the plot to it. Most people would choose something like a PNG file, like this:

png(file = "myplot.png")  # create PNG device
plot(x)                   # do the plot
dev.off()                 # return to default device (X11)

And you now have a PNG file named "myplot.png" in the current directory.

这篇关于如何在R中工作在Ubuntu中复制图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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