【发布时间】:2021-12-09 20:08:32
【问题描述】:
假设我想用 str_to_title() 函数修改一个 ggplot 轴标签。
library(tidyverse)
mtcars %>%
ggplot(aes(x = wt, y = mpg)) +
geom_point() +
labs(x = ~str_to_title(.x))
我的 x 轴不会被标记为“Wt”,而是会被标记为“str_to_title(.x)”。有没有办法在 labs() 函数中应用函数?
【问题讨论】: