如何在ggplot中使用annotate_figure将标题(fig.label)放置在正确的位置?

时间:2019-02-27 21:43:48

标签: r ggplot2 ggpubr

我正在使用库ggarange中的函数ggpubr来绘制2个饼图。问题在于annotate_figure函数无法满足我的实际需求。

final_plot<-ggarrange(plot1,plot2,ncol=2,common.legend=TRUE, legend = "right")

final_plot %>% 

annotate_figure(

top = text_grob(
  "In 2017, U.S citizens prefer to use \nstation-based bikes rather than dockless bikes",
  size = 14,
  face = 'bold'
),
fig.lab =
  "Source : NACTO\nScope : Shared-Bikes in the U.S. in 2017\nNote : NACTO's estimate for trips with shared bikes figure among all bike users"
,
fig.lab.pos  = "bottom.left",
fig.lab.size = 8,
fig.lab.face = "bold"
)

这是输出图形:

enter image description here

如何在每次换行时都避免在fig.label文本中左侧产生空格(即,我希望所有3行都向左对齐)?

感谢您的帮助!

0 个答案:

没有答案