R and graphics devices on Mac and Windows – part 2

This post summarizes what happens under different graphics devices on Mac and Windows when the resolution is such that the data can’t be correctly represented. Just for fun. Everything is the same as in R and graphics devices on Mac and Windows except that I changed border='transparent', col='blue' to border='blue', col='transparent'. The filling of each ploygon (cell) is now transparent and the border blue. Or at least they are supposed to. Since the resolution is only 2700 x 3000 for a data set that consists of  polygons that represent a 1185 x 2278 raster, the result will obviously not look perfect. Nevertheless, it is interesting to see how the different graphics devices deal with it.

The output for choosing different options

Default settings (“windows” vs. “quartz”)
 png(filename="plot1.png", width 3000, height = 2700)
plot(st_geometry(AT_poly), border='blue', col='transparent')
dev.off() 

On Windows this is the same as choosing type = "windows".

 png(filename="plot1.png", width 3000, height = 2700, type = "windows")
plot(st_geometry(AT_poly), border='blue', col='transparent')
dev.off() 

On (my) Mac this is the same as choosing type = "quartz".

 png(filename="plot1.png", width 3000, height = 2700, type = "quartz")
plot(st_geometry(AT_poly), border='blue', col='transparent')
dev.off() 
default_png_1
Default settings for Mac (left – 987KB) and Windows (right – 33KB). Zoom done by hand.

Now the default settings with antialias = "none".

 png(filename="plot2.png", width 3000, height = 2700, antialias = "none")
plot(st_geometry(AT_poly), border='blue', col='transparent')
dev.off() 

Again, on Windows this is the same as choosing type = "windows".

 png(filename="plot2.png", width 3000, height = 2700, type = "windows", antialias = "none")
plot(st_geometry(AT_poly), border='blue', col='transparent')
dev.off() 

And also again, on (my) Mac this is the same as choosing type = "quartz".

 png(filename="plot2.png", width 3000, height = 2700, type = "quartz", antialias = "none")
plot(st_geometry(AT_poly), border='blue', col='transparent')
dev.off() 
default_antialias_png_2
Default settings with antialias = “none” for Mac (left – 189KB) and Windows (right – 33KB). Zoom done by hand.
Type “cairo”
png(filename="plot3", width 3000, height = 2700, type = cairo)
plot(st_geometry(AT_poly), border='blue', col='transparent')
dev.off() 
cairo_png_3
type = “cairo” for Mac (left – 252KB) and Windows (right – 247KB). Zoom done by hand.
png(filename="plot4", width 3000, height = 2700, type = "cairo", antialias = "none")
plot(st_geometry(AT_poly), border='blue', col='transparent')
dev.off() 
cairo_antialias_png_4
type = “cairo” and antialias = “none” for Mac (left – 31KB) and Windows (right – 36KB). Zoom done by hand.
Type “cairo-png”
png(filename="plot5", width 3000, height = 2700, type = "cairo-png")
plot(st_geometry(AT_poly), border='blue', col='transparent')
dev.off() 
cairopng_png_5
type = “cairo-png” for Mac (left – 507KB) and Windows (right – 495KB). Zoom done by hand.
png(filename="plot6", width 3000, height = 2700, type = "cairo-png", antialias = "none")
plot(st_geometry(AT_poly), border='blue', col='transparent')
dev.off() 
cairopng_antialias_png_6
type = “cairo-png” and antialias = “none” for Mac (left – 43KB) and Windows (right – 60KB). Zoom done by hand.

Conclusion

The output differs significantly between the different options as well as between the operating systems. Also the file sizes differ a lot. The sizes I provide are always for the entire image and not just the zoom.

One thought on “R and graphics devices on Mac and Windows – part 2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s