How can I fully left-justify text when using atop()
?
library(tidyverse)
mtcars %>%
mutate(cyl = str_c("atop(bold(", cyl, "~long~text~on~the~top),(shorttext))")) %>%
ggplot(aes(hp, wt)) +
geom_line() +
facet_wrap(~cyl, labeller = label_parsed) +
theme(strip.text.x = element_text(hjust = 0))
Nowadays I would certainly answer this using the fantastic ggtext
package
library(tidyverse)
library(ggtext)
mtcars %>%
mutate(cyl = str_c("**", cyl, " long text on the top**<br>(shorttext)")) %>%
ggplot(aes(hp, wt)) +
geom_line() +
facet_wrap(~cyl) +
theme(strip.text.x = element_markdown(hjust = 0))
Created on 2021-01-03 by the reprex package (v0.3.0)