Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A question about theme_xx() and theme() #5501

Closed
Rong-Zh opened this issue Oct 28, 2023 · 1 comment
Closed

A question about theme_xx() and theme() #5501

Rong-Zh opened this issue Oct 28, 2023 · 1 comment

Comments

@Rong-Zh
Copy link

Rong-Zh commented Oct 28, 2023

library(tidyverse)
platform : Windows 10 x64 build 19045
ggplot2: 3.4.4

the title of the figure is correctly displayed in center with the following code

iris %>% ggplot(aes(Sepal.Width, Petal.Length, color = Species)) +
  geom_point() +
  labs(title = "Test") +
  theme_test() +
  theme(plot.title = element_text(hjust = 0.5))

theme_test() is used after the theme(), the title of the figure incorrectly appears on the left.
the title of the figure should be centered.

iris %>% ggplot(aes(Sepal.Width, Petal.Length, color = Species)) +
  geom_point() +
  labs(title = "Test") +
  theme(plot.title = element_text(hjust = 0.5)) +
  theme_test()
appendix
@teunbrand
Copy link
Collaborator

The order of operations matter, so in your second plot, theme_test() is overriding anything you might have declared in theme() before. In any case, this issue tracker is to report bugs or request features. For questions or help, try the community or stackoverflow.

@teunbrand teunbrand closed this as not planned Won't fix, can't repro, duplicate, stale Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants