当使用atop()时完全左对齐

4
当使用 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))


1
str_c("atop(bold(", cyl, "),(X))") - Axeman
这个接近了,但还没有完全解决问题,我会更新我的示例。 - John-Henry
1个回答

0
现在我肯定会使用非常棒的`ggtext`包来回答这个问题。
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))

reprex包 (v0.3.0)于2021-01-03创建


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接