如何在tag_facets()中创建新行?
在图的第一个方面,我在顶角上有一个标题,上面写着“这很有趣”,但我希望它显示为:
this is interesting
what now
每次我放入\ n
时我想要一条新行,但是我不确定如何在tag_facets()
的上下文中进行操作。
data(iris)
library(ggplot2)
# devtools::install_github("eliocamp/tagger")
library(tagger)
ggplot(data=iris, aes(x = Sepal.Length, y = Sepal.Width)) + geom_point(aes(color=Species, shape=Species)) +
xlab("Sepal Length") + ylab("Sepal Width") +
ggtitle("Sepal Length-Width") +
tag_facets(
tag_pool = c("this is interesting\nwhat now", "for what:\nnow", "hey:\nhow are you?"),
tag_suffix = "",
position = "tr") +
theme(tagger.panel.tag.background = element_rect(fill = "white")) + facet_wrap(~Species)
任何指导都将不胜感激!
In the first facet of the graph, I have a caption in the top corner that says, "this is interesting what now" but I would like it to show up as:
this is interesting
what now
Every time I put in \n
I would like a new line, but I'm not sure how to do it in the context of tag_facets()
.
data(iris)
library(ggplot2)
# devtools::install_github("eliocamp/tagger")
library(tagger)
ggplot(data=iris, aes(x = Sepal.Length, y = Sepal.Width)) + geom_point(aes(color=Species, shape=Species)) +
xlab("Sepal Length") + ylab("Sepal Width") +
ggtitle("Sepal Length-Width") +
tag_facets(
tag_pool = c("this is interesting\nwhat now", "for what:\nnow", "hey:\nhow are you?"),
tag_suffix = "",
position = "tr") +
theme(tagger.panel.tag.background = element_rect(fill = "white")) + facet_wrap(~Species)
Any guidance would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题是
tagger
使用gridtext :: richtext_grob
在引擎盖下,它允许通过html,css和markdown进行格式化,但需要使用< br> 而不是
\ n
添加销售折断:The issue is that
tagger
usesgridtext::richtext_grob
under the hood which allows for formatting via HTML, CSS and markdown but requires to use<br>
instead of\n
to add line breaks:这是你想要的吗?
Is this what you want?