Skip to content

guide_colorsteps() can't set the position #5930

Closed
@Andtise

Description

@Andtise

In my use of the newer version of ggplot2 (version3.5.1), I found that I can't set the position for guide_colorstep individually, but only through the global theme's legend.position.

I'm not sure if this is intentional or not, but I think it doesn't follow the logic of guides as a whole. Here's a simple example:

library(ggplot2)

# position not working of guide_colorsteps
p1 <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
  geom_point() +
  guides(color=guide_colorsteps(position = "bottom"))

# position working of guide_colorbar
p2 <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
  geom_point() +
  guides(color=guide_colorbar(position = "bottom"))

# global theme’s legend.position setting
p3 <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
  geom_point() +
  guides(color=guide_colorsteps()) +
  theme(legend.position = "bottom")

patchwork::wrap_plots(p1, p2, p3)

bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorguides 📏

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions