小编ali*_*nk8的帖子

R:ggplot2,我可以将facet/strip文本换行吗?

我发现这是非常有用的代码文本换行位置:

 wrapper <- function(x, ...) paste(strwrap(x, ...), collapse = "\n")`

 my_title <- "This is a really long title of a plot that I want to nicely wrap and fit onto the plot without having to manually add the backslash n, but at the moment it does not"

 r + geom_smooth() + opts(title = wrapper(my_title, width = 20))
Run Code Online (Sandbox Code Playgroud)

我想用它来将文本包装在一个方面/条带中,但不知道如何.

 p + geom_bar(stat="identity")+facet_wrap(~variable1) + 
    opts(strip.text.x=theme_text(size=12, face="bold")
Run Code Online (Sandbox Code Playgroud)

它是否传递给strip.text.x选项?

r ggplot2

5
推荐指数
2
解决办法
4191
查看次数

标签 统计

ggplot2 ×1

r ×1