-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Consistently use element_grob() or element_render() instead of textGrob() #3557
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
Comments
Axis text for non-standard axis position was first reported here: wilkelab/ggtext#5 But now that I'm thinking about it, I think it works fine, so I'll check it off as Ok. |
Facet labels when using library(tidyverse)
library(ggtext)
library(glue)
#>
#> Attaching package: 'glue'
#> The following object is masked from 'package:dplyr':
#>
#> collapse
count(mtcars, cyl, carb) %>%
mutate(cyl_lab = as.character(
glue("Cylinders {cyl} <span style='color:red'>(n={n})</span>")
)) %>%
ggplot(aes(carb, n)) +
geom_col() +
facet_wrap(~cyl_lab) +
theme(
strip.text = element_markdown(),
strip.text.x = element_markdown(),
strip.text.y = element_markdown()
) Created on 2019-10-07 by the reprex package (v0.3.0) @hrbrmstr Anything you'd like to add? |
The same problem exists in library(tidyverse)
library(ggtext)
library(glue)
#>
#> Attaching package: 'glue'
#> The following object is masked from 'package:dplyr':
#>
#> collapse
count(mtcars, cyl, carb) %>%
mutate(cyl_lab = as.character(
glue("Cylinders {cyl} <span style='color:red'>(n={n})</span>")
)) %>%
ggplot(aes(carb, n)) +
geom_col() +
facet_grid(~cyl_lab) +
theme(
strip.text = element_markdown(),
strip.text.x = element_markdown(),
strip.text.y = element_markdown()
) Created on 2019-10-07 by the reprex package (v0.3.0) |
Tagging this for the 3.3.0 milestone, with the understanding that it may not be possible to complete by then. |
For me rendered facet labels work, boxes could be checked. Thanks once again for this wonderful package! |
There are a few cases where we call
textGrob()
directly instead ofelement_grob()
orelement_render()
. Ideally, we should eliminate all of them. Here is a list of cases I'm currently aware of. There may be more. Reprexes will follow below.facet_wrap()
facet_grid()
(Checkmark means the issue has been addressed.)
The text was updated successfully, but these errors were encountered: