使用 atop() 时完全左对齐
Fully Left-Justify When Using atop()
如何在使用 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))
现在我肯定会使用出色的 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 package (v0.3.0)
创建于 2021-01-03
如何在使用 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))
现在我肯定会使用出色的 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 package (v0.3.0)
创建于 2021-01-03