Skip to content

Updating scale instead of replacing #6346

Closed
@jbengler

Description

@jbengler

Hi Teun!

I’ve always wondered about this. Is there a way to update a scale instead of replacing it, similar to how theme() works?

If not, would there be a way to implement this?

library(ggplot2)

p <- 
  mtcars |> 
  ggplot(aes(disp, drat)) +
  geom_point()

# themes are updated
p + 
  theme(panel.grid.major = element_line(color = "pink")) + 
  theme(panel.grid.minor = element_line(color = "blue"))

# scales are replaced
p +
  scale_x_continuous(limits = c(100, 200)) +
  scale_x_continuous(trans = "log10")

Best
Jan

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