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

ggthemr_reset() cannot be completely cleared #55

Open
perlatex opened this issue May 7, 2022 · 2 comments · May be fixed by #56
Open

ggthemr_reset() cannot be completely cleared #55

perlatex opened this issue May 7, 2022 · 2 comments · May be fixed by #56

Comments

@perlatex
Copy link

perlatex commented May 7, 2022

The old problem did not appear, but the new problem appeared.

library(tibble)
library(dplyr)
library(ggplot2)


tb <- tibble(
  x = letters[1:9],
  y = 1:9
)

tb %>%
  ggplot(aes(x, y, color = x)) +
  geom_point()

AA

but,after load ggthemr

library(ggthemr)
ggthemr("dust")
ggthemr_reset()


# does not work
tb %>%
  ggplot(aes(x, y, color = x)) +
  geom_point()
# Error: Your data requires 9 colours but the swatch provided by ggthemr only has 8. To resolve this you can provide an appropriate 
# vector of colours to your scale or expand the swatch using set_swatch(). Note: if you are using a custom palette, the first swatch colour 
# is separate from the others. See the documentation for define_palette() and/or set_swatch()

still does not work

pacman::p_unload("ggthemr")

tb %>%
  ggplot(aes(x, y, color = x)) +
  geom_point()
# Error: Your data requires 9 colours but the swatch provided by ggthemr only has 8. To resolve this you can provide an appropriate 
# vector of colours to your scale or expand the swatch using set_swatch(). Note: if you are using a custom palette, the first swatch colour 
# is separate from the others. See the documentation for define_palette() and/or set_swatch()

Matt-Int added a commit to Matt-Int/ggthemr that referenced this issue May 7, 2022
This should fix Mikata-Project#55 as the reset didn't reset the UK spelling for the
options (see Mikata-Project#52)
@Matt-Int Matt-Int linked a pull request May 7, 2022 that will close this issue
@Matt-Int
Copy link
Contributor

Matt-Int commented May 7, 2022

Hey @perlatex

Looks like the reset function didn't reset the appropriate options, hence why unloading the namespace also didn't work. I've fixed that in #56, in the meantime you can manually reset the options:

options('ggplot2.discrete.colour' = NULL)
options('ggplot2.continuous.colour' = NULL)

Alternatively you can install the temporary branch by using remotes::install_github("matt-int/ggthemr@issue_55")

@perlatex
Copy link
Author

perlatex commented May 7, 2022

it work for me, thanks @Matt-Int

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

Successfully merging a pull request may close this issue.

2 participants