ggplot2脚注
在使用 ggplot2 创建的绘图底部添加脚注的最佳方法是什么?我尝试使用所述逻辑的组合 此处 以及 ggplot2 annotate
函数。
p + annotate("text",label="Footnote",
x=unit(1,"npc") - unit(2, "mm"),y=unit(2, "mm"),
just=c("right", "bottom"),gp=gpar(cex= 0.7, col=grey(.5)))
但我收到错误
as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) 中的错误:无法将类 c("unit.arithmetic", "unit") 强制转换为 data.frame< /p>
What is the best way to add a footnote to the bottom of a plot created with ggplot2? I've tried using a combination of the logic noted here as well as the ggplot2 annotate
function.
p + annotate("text",label="Footnote",
x=unit(1,"npc") - unit(2, "mm"),y=unit(2, "mm"),
just=c("right", "bottom"),gp=gpar(cex= 0.7, col=grey(.5)))
but I am getting the error
Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : cannot coerce class c("unit.arithmetic", "unit") into a data.frame
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
labs(caption = "我的标题")
Use
labs(caption = "my caption")
我会使用类似的东西:
I would use something like that: