我使用GGPLOT2库和上午与qplot命令工作 我知道我可以通过我的qplot后使用下面的命令我的输出保存为一个反走样图像文件

ggsave(file="filename.png")

但如何对我的液晶显示器?是有什么办法可以看到显示器的反走样grpah在一块土地上?

有帮助吗?

解决方案

在Windows上,有没有内置的抗锯齿。我不知道是否计划在将来的版本与否。你可以从任一cairoDeviceCairo包一个设在开罗的图形设备;但是,您将需要首先安装GTK+

http://gladewin32.sourceforge.net/

下载和安装Gtk+ 2.12.9 Runtime Environment Revision 2

另一种选择是通过JGRhttp://jgr.markushelbig.org/)使用基于Java的图形。还基于Qt装置正在开发中,我想。

其他提示

正如其他人所说,R内置在Windows图形设备没有做抗锯齿。但现在它很容易安装Cairo图形装置一样。

目前R控制台:

install.packages('Cairo',,'http://www.rforge.net/')

要测试:

plot(rnorm(1000)) # non-antialiased (on Windows)
library('Cairo')
CairoWin()
plot(rnorm(1000)) # antialiased!

详情

如果您已经安装了开罗(见其他答案),将其保存为一个抗锯齿PNG,只是改变你的代码:

ggsave(file="filename.png", type="cairo-png")

作为指定此处

但是,出于什么目的你想“看到显示器的反走样图上的曲线”或“抗混叠积我的窗口”?如果你的意思是像在RStudio的情节窗口(标签),我不知道可以做,它基本上只提供作为预览。我建议你的图形保存到一个文件,然后使用该文件来显示它或者用于任何其他目的。

好,我只是检查。我错在我先前的评论。从help(x11)其中很多细节是可用 - 新的基于开罗的设备确实具有抗混叠可用:

  

X11包:grDevices   R文件

     

X窗口系统的图形

     

说明

 ‘X11’ starts a graphics device driver for the X Window System
 (version 11).  This can only be done on machines/accounts that
 have access to an X server.

 ‘x11’ is recognized as a synonym for ‘X11’.
     

用法:

 X11(display = "", width, height, pointsize, gamma, bg, canvas,
     fonts, xpos, ypos, title, type, antialias)

 X11.options(..., reset = FALSE)
     

参数:

     

[...]

 fonts: X11 font description strings into which weight, slant and
      size will be substituted.  There are two, the first for fonts
      1 to 4 and the second for font 5, the symbol font.  See
      section ‘Fonts’. 
     

[...]

 antialias: for cairo types, the typeof anti-aliasing (if any) to be
      used.  One of ‘c("default", "none", "gray", "subpixel")’. 
     

[...]

     

详细说明:

 The defaults for all of the arguments of ‘X11’ are set by
 ‘X11.options’: the ‘Arguments’ section gives the ‘factory-fresh’
 defaults.

 The initial size and position are only hints, and may not be acted
 on by the window manager.  Also, some systems (especially laptops)
 are set up to appear to have a screen of a different size to the
 physical screen.

 Option ‘type’ selects between two separate devices: R can be built
 with support for neither, ‘type = "Xlib"’ or both.  Where both are
 available, types ‘"cairo"’ and ‘"nbcairo"’ offer

    * antialiasing of text and lines.

    * translucent colours.

    * scalable text, including to sizes like 4.5 pt.

    * full support for UTF-8, so on systems with suitable fonts you
      can plot in many languages on a single figure (and this will
      work even in non-UTF-8 locales).  The output should be
      locale-independent.

 ‘type = "nbcairo"’ is the same device as ‘type="cairo"’ without
 buffering: which is faster will depend on the X11 connection.
 Both will be slower than ‘type = "Xlib"’, especially on a slow X11
 connection as all the rendering is done on the machine running R
 rather than in the X server.

 All devices which use an X11 server (including the ‘type = "Xlib"’
 versions of bitmap devices such as ‘png’) share internal
 structures, which means that they must use the same ‘display’ and
 visual.  If you want to change display, first close all such
 devices. 
     

[...和更多...]

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top