Frage

Ich verwende ggplot2-Bibliothek und arbeite mit der qplot Befehl Ich weiß, ich kann speichern Sie die Ausgabe als anti-Aliasing-image-Datei mit dem folgenden Befehl nach meiner qplot

ggsave(file="filename.png")

Aber was ist mit meinem LCD-display?gibt es eine Möglichkeit zu sehen, ein Grundstück auf dem monitor als anti-alias-grpah?

War es hilfreich?

Lösung

Unter Windows gibt es keine integrierten Anti-Aliasing. Ich weiß nicht, ob es für zukünftige Versionen geplant ist oder nicht. Sie können ein Kairo-Grafik Gerät entweder von den cairoDevice oder Cairo Paketen erhalten; jedoch müssen Sie GTK+ zuerst installieren:

Herunterladen und Installieren von Gtk+ 2.12.9 Runtime Environment Revision 2 von http://gladewin32.sourceforge.net/

Eine andere Möglichkeit wäre, Java-basierte Grafiken durch JGR zu verwenden (http://jgr.markushelbig.org/). Auch ein Qt-basiertes Gerät ist in der Entwicklung, denke ich.

Andere Tipps

Wie andere erwähnt haben, R integrierten Windows-Grafikgerät ist nicht Anti-Aliasing. Aber heutzutage ist es einfach, die Kairo Grafikgerät zu installieren, die der Fall ist.

Bei der R-Konsole:

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

Zum Test:

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

Mehr

Wenn Sie Kairo installiert sein (siehe die anderen Antworten), um Sie zu retten, als ein anti-Aliasing PNG, ändern Sie einfach Ihren code ein:

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

wie angegeben hier.

Aber für welchen Zweck möchten Sie zu sehen, die ein Grundstück auf dem monitor als anti-alias-graph" oder "anti-alias-meine plot-Fenster"?Wenn du meinst wie in den Plots-Fenster (Registerkarte) in RStudio, ich bin nicht sicher, dass getan werden kann, es dient im Grunde nur als Vorschau.Ich schlage vor, Sie speichern Sie die Grafik in eine Datei und verwenden Sie diese Datei, um diese anzuzeigen oder für andere Zwecke verwendet.

Ok, ich habe gerade überprüft. Ich war in meinem früheren Kommentar falsch. Von help(x11) wo viele Details zur Verfügung steht - die neuen Kairo-basierte Geräte haben tun Anti-Aliasing zur Verfügung:

  

x11-Paket: grDevices   R Dokumentation

     

X Window System Graphics

     

Beschreibung:

 ‘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’.
     

Verbrauch:

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

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

Argumente:

     

[...]

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

[...]

     

Details:

 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. 
     

[... mehr ...]

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top