在闪亮的上下文中,我如何删除绘图标题中括号前后的额外空格?如下图所示,"(“和"6”之间以及"+“和")”之间有多余的空格。
此外,我想知道如何才能将标题分解为下一行显示县名称和年龄组。

下面是我的代码:
ggtitle(
paste(
"Percentage of Population Living with and Responsible for Grandchildren in",
input$county_grandpa,
"(",
input$Age_Group_grandpa,
")"
)
)发布于 2020-01-21 03:24:33
这将为您做好这项工作。paste0没有像paste那样的sep = " ",并且\n添加了新的一行。如果希望文本居中,请添加theme。
ggtitle(
paste0(
"Percentage of Population Living with and Responsible for Grandchildren in \n",
input$county_grandpa,
" (",
input$Age_Group_grandpa,
")"
)
) +
theme(plot.title = element_text(hjust = 0.5))https://stackoverflow.com/questions/59829554
复制相似问题