Skip to content

ggsave + theme_minimal background issues #4919

Closed
@cmartin

Description

@cmartin

For some reason, using ggsave on a theme_minimal plot messes up with the background of my plots, which I need to manually specify to white to get the expected behaviour.

I'm using R 4.1.1 on Windows 10, with ggplot2 version 3.3.6.

library(ggplot2)
ggplot(msleep, aes(sleep_rem, sleep_total)) + geom_point()
ggsave("white.jpg")
ggplot(msleep, aes(sleep_rem, sleep_total)) + geom_point() + theme_minimal()
ggsave("black.jpg")
ggplot(msleep, aes(sleep_rem, sleep_total)) + geom_point() + theme_minimal()
ggsave("white2.jpg", bg = "white")

As of last week, I never had to specify the bg color in ggsave to have the white one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions