Closed z3tt closed 4 years ago
I think this is the same as issue #5. I'll have to add this to the documentation.
library(tidyverse)
library(ggtext)
theme_update(axis.text.x = element_markdown(size = 15))
labs <- c("**ten**", "<i>twenty</i>", "<span style='color:#0072B2'>thirty<span>")
ggplot(mtcars, aes(mpg, cyl)) +
geom_point() +
scale_x_continuous(breaks = c(10, 20, 30),
position = "top",
labels = labs) +
theme(axis.text.x.top = element_markdown(size = 15))
Created on 2019-12-13 by the reprex package (v0.3.0)
Yes, sorry wasn't searching through the closed issues since it's still relevant. Thanks for the quick feedback!
Great, works perfectly! Thanks for the help!
See also: https://github.com/tidyverse/ggplot2/issues/3557
Facet strips genuinely don't work.
This solution is also required for facet strip labels positioned on the left.
mtcars %>%
group_by(cyl) %>%
mutate(cyl_lab = as.character(
glue("Cylinders {cyl} <span style='color:red'>(n={n()})</span>")
)) %>%
ggplot(aes(disp, mpg)) +
geom_point() +
facet_wrap(~cyl_lab, strip.position = "left") +
theme(
strip.text.y = element_markdown(), #<< doesn't work for left strip text
strip.text.y.left = element_markdown() #<< does work
)
Hi Claus,
thanks again for your wonderful contribution to the ggplot2-verse! I love this package and use it for almost all plots since then and it works like a charm - most of the time. I know it's a dev version so I just want to report a bug I've found (without expecting you to fix it soon):
Created on 2019-12-13 by the reprex package (v0.3.0)
All the best, Cédric