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()

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()

Type “cairo”
png(filename="plot3", width 3000, height = 2700, type = cairo) plot(st_geometry(AT_poly), border='blue', col='transparent') dev.off()

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

Type “cairo-png”
png(filename="plot5", width 3000, height = 2700, type = "cairo-png") plot(st_geometry(AT_poly), border='blue', col='transparent') dev.off()

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

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”