Pergunta

Estou usando a biblioteca GGPlot2 e estou trabalhando com o comando QPlot, eu sei que posso salvar minha saída como um arquivo de imagem anti-aliases usando o seguinte comando após meu qplot

ggsave(file="filename.png")

Mas e quanto à minha tela LCD? Existe alguma maneira de ver um enredo no monitor como GRPAH anti-alias?

Foi útil?

Solução

No Windows, não há anti-aliasing embutido. Não sei se está planejado para lançamentos futuros ou não. Você pode obter um dispositivo gráfico baseado em Cairo de qualquer cairoDevice ou Cairo pacotes; No entanto, você precisará instalar GTK+ primeiro:

Baixar e instalar Gtk+ 2.12.9 Runtime Environment Revision 2 a partir de http://gladewin32.sourceforge.net/

Outra opção seria usar gráficos baseados em Java por meio JGR (http://jgr.markushelbig.org/). Também um Qt-O dispositivo baseado está em desenvolvimento, eu acho.

Outras dicas

Como outros mencionaram, o dispositivo gráfico Windows interno do R não faz anti-aliasing. Mas hoje em dia é fácil instalar o dispositivo gráfico do Cairo.

No console R:

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

Testar:

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

Mais

Se você instalou o Cairo (veja as outras respostas), para salvá-lo como um PNG anti-alias, basta alterar seu código para:

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

como especificado aqui.

Mas com que finalidade você deseja "ver um enredo no monitor como gráfico anti-alias" ou "anti-alias minhas janelas da trama"? Se você quer dizer como na janela das plotagens (guia) em rstudio, não tenho certeza de que isso possa ser feito, ele serve basicamente apenas como uma visualização. Sugiro que você salve o gráfico em um arquivo e use este arquivo para exibi -lo ou para qualquer outro propósito.

Ok, acabei de verificar. Eu estava errado no meu comentário anterior. A partir de help(x11) Onde muitos detalhes estão disponíveis-os novos dispositivos baseados no Cairo têm anti-aliasing disponível:

pacote x11: documentação grdevices r

X Gráficos do Sistema de Janelas

Descrição:

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

Uso:

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

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

Argumentos:

[...]

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

[...]

Detalhes:

 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. 

...e mais...

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top