Skip to content

Fix theme inheritance when not inheriting from blank #3663

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

Merged
merged 3 commits into from
Dec 12, 2019

Conversation

clauswilke
Copy link
Member

I think this fixes #3662. I still want to add a few additional unit tests to prevent future such regressions.

I had to update one vdiffr reference image because it wasn't drawn correctly previously. (Line styling wasn't properly inherited across a blank element.)

library(ggplot2)

ggplot(mtcars) + 
  geom_point(aes(disp, mpg)) + 
  facet_wrap(~gear) + 
  theme(strip.text = element_blank(), strip.text.x = element_text())

Created on 2019-12-11 by the reprex package (v0.3.0)

@clauswilke
Copy link
Member Author

The bayesplot examples seem to all run now. Not sure if any of them look wrong.

library(bayesplot)
#> This is bayesplot version 1.7.1
#> - Online documentation and vignettes at mc-stan.org/bayesplot
#> - bayesplot theme set to bayesplot::theme_default()
#>    * Does _not_ affect other ggplot2 plots
#>    * See ?bayesplot_theme_set for details on theme setting

color_scheme_set("blue")
color_scheme_view()

color_scheme_get()
#>      blue
#> 1 #d1e1ec
#> 2 #b3cde0
#> 3 #6497b1
#> 4 #005b96
#> 5 #03396c
#> 6 #011f4b
color_scheme_get(i = c(3, 5)) # 3rd and 5th colors only
#> $mid
#> [1] "#6497b1"
#> 
#> $dark
#> [1] "#03396c"

color_scheme_get("brightblue")
#>   brightblue
#> 1    #cce5ff
#> 2    #99cbff
#> 3    #4ca5ff
#> 4    #198bff
#> 5    #0065cc
#> 6    #004c99
color_scheme_view("brightblue")

# compare multiple schemes
color_scheme_view(c("pink", "gray", "teal"))

color_scheme_view(c("viridis", "viridisA", "viridisB", "viridisC"))

color_scheme_set("pink")
x <- example_mcmc_draws()
mcmc_intervals(x)

color_scheme_set("teal")
color_scheme_view()

mcmc_intervals(x)

color_scheme_set("red")
mcmc_areas(x, regex_pars = "beta")
#> Warning: `expand_scale()` is deprecated; use `expansion()` instead.

color_scheme_set("purple")
color_scheme_view()

y <- example_y_data()
yrep <- example_yrep_draws()
ppc_stat(y, yrep, stat = "mean") + legend_none()
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

############################
### Mixing color schemes ###
############################
color_scheme_set("mix-teal-pink")
ppc_stat(y, yrep, stat = "sd") + legend_none()
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

mcmc_areas(x, regex_pars = "beta")
#> Warning: `expand_scale()` is deprecated; use `expansion()` instead.

##########################
### ColorBrewer scheme ###
##########################
color_scheme_set("brewer-Spectral")
color_scheme_view()

mcmc_trace(x, pars = "sigma")

###########################
### Custom color scheme ###
###########################
orange_scheme <- c("#ffebcc", "#ffcc80",
                   "#ffad33", "#e68a00",
                   "#995c00", "#663d00")
color_scheme_set(orange_scheme)
color_scheme_view()

mcmc_areas(x, regex_pars = "alpha")
#> Warning: `expand_scale()` is deprecated; use `expansion()` instead.

mcmc_dens_overlay(x)

ppc_stat(y, yrep, stat = "var") + legend_none()
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Created on 2019-12-11 by the reprex package (v0.3.0)

@clauswilke
Copy link
Member Author

@jgabry @tjmahr Could you review the bayesplot examples in the preceding comment for any rendering errors? We did some refactoring of the ggplot2 theme code and I want to make sure there aren't any further regressions.

@clauswilke clauswilke requested a review from thomasp85 December 12, 2019 05:28
Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@clauswilke clauswilke merged commit 0315dc3 into tidyverse:master Dec 12, 2019
@clauswilke clauswilke deleted the issue-3662-strip-themeing branch December 12, 2019 21:16
@jgabry
Copy link

jgabry commented Dec 20, 2019

Sorry for not chiming in sooner. LGTM too, and thanks for reaching out!

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 this pull request may close these issues.

Regression: error when themeing strip text
3 participants