Skip to content

(Potential) bug with theme within guide_* call #6102

Closed as not planned
Closed as not planned
@kylebutts

Description

@kylebutts

It is very possible that I'm misunderstanding how to use the theme object within guide_*, but applying themes does not seem to work for me. I am using the most recent development version of ggplot2.

Edit: After some more testing, only the legend.x options are not working

library(ggplot2)
ggplot() +
  geom_point(
    aes(x = mpg, y = hp, color = as.factor(cyl)),
    data = mtcars
  ) +
  scale_color_manual(
    values = c("red", "blue", "green"),
    guide = guide_legend(
      theme = theme(legend.position = "bottom")
    )
  )

ggplot() +
  geom_point(
    aes(x = mpg, y = hp, color = as.factor(cyl)),
    data = mtcars
  ) +
  scale_color_manual(
    values = c("red", "blue", "green"),
    guide = guide_legend()
  ) +
  theme(legend.position = "bottom")

Created on 2024-09-12 with reprex v2.1.0

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