문제

ggplot2 라이브러리를 사용하고 있으며 qplot 명령으로 작업하고 있습니다. qplot 이후 다음 명령을 사용하여 출력을 방지 이미지 파일로 저장할 수 있다는 것을 알고 있습니다.

ggsave(file="filename.png")

하지만 내 LCD 디스플레이는 어떻습니까? 모니터의 음모를 anti-aliased grpah로 볼 수있는 방법이 있습니까?

도움이 되었습니까?

해결책

Windows에는 내장 된 aliasing이 없습니다. 나는 그것이 향후 릴리스를 위해 계획되었는지 여부를 모른다. 카이로 기반 그래픽 장치를 cairoDevice 또는 Cairo 패키지; 그러나 설치해야합니다 GTK+ 첫 번째:

다운로드 및 설치 Gtk+ 2.12.9 Runtime Environment Revision 2 ~에서 http://gladewin32.sourceforge.net/

또 다른 옵션은 Java 기반 그래픽을 사용하는 것입니다 JGR (http://jgr.markushelbig.org/). 또한 a Qt-기반 장치가 개발 중이라고 생각합니다.

다른 팁

다른 사람들이 언급했듯이 R의 내장 된 Windows 그래픽 장치는 앨리어싱 방지를 수행하지 않습니다. 그러나 요즘에는 카이로 그래픽 장치를 쉽게 설치할 수 있습니다.

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")

지정된대로 여기.

그러나 어떤 목적을 위해 "모니터의 음모를 anti-aliased 그래프로보고 싶습니까? rstudio의 Plots Window (Tab)에서 같은 의미가 있다면, 그 일을 할 수 있는지 확실하지 않으며 기본적으로 미리보기처럼 사용됩니다. 그래프를 파일에 저장 한 다음이 파일을 사용하여 표시하거나 다른 목적으로 표시하는 것이 좋습니다.

좋아, 방금 확인했다. 나는 나의 이전 의견에서 틀렸다. 에서 help(x11) 많은 세부 사항을 사용할 수있는 경우-새로운 카이로 기반 장치에는 안티 아일리 아스가 있습니다.

X11 패키지 : GRDEVICE 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