R 中的 qplot 和抗锯齿
我正在使用 ggplot2 库并使用 qplot 命令 我知道我可以在 qplot 之后使用以下命令将输出保存为抗锯齿图像文件,
ggsave(file="filename.png")
但是我的 LCD 显示器怎么样?有什么方法可以在监视器上看到抗锯齿 grpah 的绘图吗?
I am using ggplot2 library and am working with the qplot command
I know I can save my output as an anti-aliased image file by using the following command after my qplot
ggsave(file="filename.png")
But how about my LCD display? is there any way to see a plot on the monitor as anti-aliased grpah?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
正如其他人提到的,R 的内置 Windows 图形设备不执行抗锯齿功能。但现在安装 Cairo 图形设备很容易。
在 R 控制台:
要测试:
更多
As others have mentioned, R's built-in Windows graphics device does not do anti-aliasing. But nowadays it's easy to install the Cairo graphics device which does.
At the R console:
To test:
More
在 Windows 上,没有内置的抗锯齿功能。我不知道未来版本是否有计划。您可以从
cairoDevice
或Cairo
包中获取基于 Cairo 的图形设备;但是,您需要先安装GTK+
:从 http://gladewin32.sourceforge.net/
另一种选择是通过
JGR
使用基于 Java 的图形 (http://jgr .markushelbig.org/
)。我认为基于 Qt 的设备也正在开发中。On Windows, there is no built-in anti-aliasing. I don't know whether it is planned for future releases or not. You can get a Cairo-based graphics device from either the
cairoDevice
orCairo
packages; however, you will need to installGTK+
first:Download and install
Gtk+ 2.12.9 Runtime Environment Revision 2
from http://gladewin32.sourceforge.net/Another option would be to use Java-based graphics through
JGR
(http://jgr.markushelbig.org/
). Also aQt
-based device is under development, I think.如果您安装了 Cairo(请参阅其他答案),要将其另存为抗锯齿 PNG,只需将代码更改为:
ggsave(file="filename.png", type="cairo-png")< /code>
如此处指定。
但是出于什么目的,您想要“在监视器上看到图形作为抗锯齿图形”或“对我的绘图窗口进行抗锯齿”?如果您的意思是像 RStudio 中的绘图窗口(选项卡)一样,我不确定是否可以做到,它基本上只是作为预览。我建议您将图表保存到文件中,然后使用该文件来显示它或用于任何其他目的。
If you have Cairo installed (see the other answers), to save it as an anti-aliased PNG, just change your code to:
ggsave(file="filename.png", type="cairo-png")
as specified here.
But for what purpose do you want to "see a plot on the monitor as anti-aliased graph" or "anti-alias my plot windows"? If you mean like in the Plots window (tab) in RStudio, I am not sure that can be done, it serves basically just as a preview. I suggest you save the graph to a file and then use this file to display it or for any other purpose.
好的,我刚刚检查过。我之前的评论是错误的。从
help(x11)
中可以获得很多详细信息 - 基于开罗的新设备确实具有抗锯齿功能:Ok, I just checked. I was wrong in my earlier comment. From
help(x11)
where a lot of detail is available -- the new Cairo-based devices do have anti-aliasing available: