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?
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:
install.packages('Cairo',,'http://www.rforge.net/')
To test:
plot(rnorm(1000)) # non-antialiased (on Windows)
library('Cairo')
CairoWin()
plot(rnorm(1000)) # antialiased!
More
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
or Cairo
packages; however, you will need to install GTK+
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 a Qt
-based device is under development, I think.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With