Mikata-Project / ggthemr

Themes for ggplot2.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

define_pallette not working for colours

farhadsalimi opened this issue · comments

library(ggthemr)
#> Loading required package: ggplot2
library(tidyverse)
#> Warning: package 'tidyr' was built under R version 4.1.2
#> Warning: package 'readr' was built under R version 4.1.2
#> Warning: package 'dplyr' was built under R version 4.1.2

set.seed(12345)
random_colours <- sample(colors()[-c(1, 253, 361)], 10L)

ugly <- define_palette(
  swatch = random_colours,
  gradient = c(lower = random_colours[1L], upper = random_colours[2L])
)

ggthemr(ugly)

mtcars %>%
  ggplot(aes(x = disp, 
             y = mpg,
             col = as.factor(gear))
  ) +
  geom_point() 

Created on 2022-04-11 by the reprex package (v2.0.1)

I'm pretty sure this is the same as #44 (which is fixed in #52) could you test the matt-int/ggthemr@default_scales to see if this resolves the issue? You can install specific branches by running: devtools::install_github("matt-int/ggthemr@default_scales")

You can also add + scales_colour_ggthemr_d() to your ggplot call and the new theme colours should be applied.

As per #52, this should be fixed now -- please reopen if the problem still persists.

scales_colour_ggthemr_d() works but I can't install that specific branch

devtools::install_github("matt-int/ggthemr@default_scales")
#> Downloading GitHub repo matt-int/ggthemr@default_scales
#> Error in utils::download.file(url, path, method = method, quiet = quiet,  : 
#>   cannot open URL 'https://api.github.com/repos/matt-int/ggthemr/tarball/default_scales'

Created on 2022-04-12 by the reprex package (v2.0.1)