Search code examples
rggplot2plotresolutionbit

What does "1200 dpi at 1 bit" mean? Save plot with ggsave in R at 1 bit


I have a question about image resolution, as it's not an area with which I'm particularly familiar.

I'm saving a black and white (actually, grayscale) plot I created with ggplot() (ggplot2 package) in R using ggsave(). According to a journal's specifications, "Line art (black and white) should be scanned at 1200 dpi at 1 bit." I've specified DPI in the past, but I don't understand the "1 bit" portion (contrast this with their request for color images to be "300 dpi at 8 bit", e.g.).

What option do I use in ggsave() to ensure 1 bit (or 8 bit, e.g.)? Also, a brief explanation of a "bit" in this context (at a novice level) would be appreciated.

Currently, my code reads:

ggsave("Fig01.tiff", device="tiff", width=5, dpi=1200)

I can provide a minimal working example leading up to the above ggsave() command if needed, but I don't believe it's necessary to answer the question.


Solution

  • "One bit" means just two colours: pure black or pure white, no grays. The R devices don't support this specifically, though antialias="none" with just "black" as a colour on a white background will likely result in a just black and white pixels.

    However, I don't think R allows you to pick bit depth. It likely uses 8 bit colour for everything. Programs like ImageMagick can convert files to specific formats. The magick package in R gives access to the ImageMagick functions, but I don't know what the commands would be to rewrite an image in black and white.