ropensci / visdat

Preliminary Exploratory Visualisation of Data
https://docs.ropensci.org/visdat/
Other
450 stars 47 forks source link

Background of vis_miss() plot is transparent when saving to file #150

Closed philsf closed 1 year ago

philsf commented 1 year ago

Hi, whenever I try to save a plot from vis_miss() to file, the background of the PNG is transparent, which makes it very hard to understand the elements. Attached are a screenshot of what I get and the actual file that was created.

airquality %>% vis_miss()
ggsave("air.png", h = 4, w = 4)

Screenshot of how it looks when I open the PNG. image

The actual PNG file created from vis_miss(). air

EDIT I just found out that this does not happen if I save to a JPG (which I don't normally use). Perhaps this issue is exclusive to the PNG format?

njtierney commented 1 year ago

Hi there - yes you are correct! That is an issue with PNG images vs other formats - PNG will add transparency by default, I think there's a way to not do that, but I'm not 100% sure how to do it. All the best!