rstudio / thematic

Theme ggplot2, lattice, and base graphics based on a few simple settings.
https://rstudio.github.io/thematic/
Other
244 stars 10 forks source link

Qualitative scales not applied for geom_line or geom_density2d_filled #62

Open dgkf opened 4 years ago

dgkf commented 4 years ago

Describe the problem

Qualitative scales do not appear to be applied to ggplot2::geom_line or ggplot2::geom_density2d_filled layers. I've been using mostly thematic_with_theme to be as explicit as possible, but have also tried with thematic_on().

library(thematic)
library(ggplot2)

my_qualitative_palette <- rainbow(20)
scales::show_col(my_qualitative_palette)

simple_theme <- thematic_theme(
  fg = "#FFFFFF",
  accent = "#880000",
  bg = "#222222",
  sequential = sequential_gradient(),
  qualitative = my_qualitative_palette
)
thematic_with_theme(simple_theme, {
  ggplot(Loblolly) +
    aes(x = age, y = height, color = Seed) +
    geom_line(size = 2)
})
thematic_with_theme(simple_theme, {
  ggplot() +
    aes(x = rnorm(100), y = rnorm(100)) +
    geom_density2d_filled()
})

Session Info

Tested on - personal machine using master (95927f4) - personal machine using latest from rc-v0.1.1 branch (efdfbe9) - using the RStudio cloud examples in the README

─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.0.2 (2020-06-22)
 os       macOS Catalina 10.15.7      
 system   x86_64, darwin18.7.0        
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/Los_Angeles         
 date     2020-10-15                  

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version     date       lib source                           
 ggplot2     * 3.3.2       2020-06-19 [1] CRAN (R 4.0.2)                   
 thematic    * 0.1.1       2020-10-16 [1] Github (rstudio/thematic@efdfbe9)              

[1] /usr/local/Cellar/r/4.0.2_1/lib/R/library
cpsievert commented 4 years ago

Duplicate of #59

cpsievert commented 3 years ago

For a possible solution to this, see https://github.com/tidyverse/ggplot2/pull/4277