有一个包装文本的函数示例 参考:Text wrap for plot titles 但是,如何使文本左右对齐呢? (对齐-文本沿左边缘对齐,并调整字母和单词间距,以使文本与两个边缘齐平,也称为完全对齐或完全对齐)。
plot(rnorm(100), main = paste(
strwrap(
'This is a very long title wrapped on multiple lines without the need to adjust it by hand',
whitespace_only = TRUE,
width = 50
),
collapse = "\n"
))