user3243135
user3243135

Reputation: 820

how can I make ggplot2 X11 output less ugly?

Can anyone tell me how to make graphics plotted interactively to an X11 device look as good as it does when saved to a file? For example, I scatter plot part of the diamonds data set that comes with ggplot2 with:

library(ggplot2)
qplot(carat, price, data=diamonds, color=color, xlim=c(2,3), ylim=c(5000,10000))
ggsave("plot.png")

This is a screen shot of qplot()-ing directly to an X11 device. If you zoom on the dots you'll see they are all different-shaped splotches: http://i.imgur.com/a7fIZTE.png

and this is the same thing ggsave()d to a png. The dots look like, well, dots: http://i.imgur.com/A7TSyME.png

I am on Ubuntu linux 14.04 with R 3.0.2, ggplot2 0.9.3.1-1, both installed via apt-get. I have cairodevice installed as well, if that makes a difference.

Upvotes: 1

Views: 1198

Answers (1)

cdeterman
cdeterman

Reputation: 19960

If you indeed have cairo libraries and the Cairo package installed the CairoX11 function should provide you the increased resolution.

require(Cairo)
CairoX11()
qplot(carat, price, data=diamonds, color=color, xlim=c(2,3), ylim=c(5000,10000))

Upvotes: 1

Related Questions