R 如何将text()与多行字符串一起使用,并从y坐标向下绘制字符串?

R 如何将text()与多行字符串一起使用,并从y坐标向下绘制字符串?,r,plot,text,R,Plot,Text,如何使两个字符串的顶部在绘图上对齐 library(stringr) arep <- rep('a', 17) %>% str_c(collapse = "\n") brep <- rep('b', 10) %>% str_c(collapse = "\n") plot.new() text(x = .5, y = .5, labels = arep) text(x = .4, y = .5, labels = brep) 库(stringr) arep

如何使两个字符串的顶部在绘图上对齐

library(stringr)
arep <- rep('a', 17) %>% 
  str_c(collapse = "\n")
brep <- rep('b', 10) %>% 
  str_c(collapse = "\n")

plot.new()

text(x = .5, y = .5, labels = arep)
text(x = .4, y = .5, labels = brep)
库(stringr)
arep%
str_c(collapse=“\n”)
布雷普%
str_c(collapse=“\n”)
plot.new()
文本(x=0.5,y=0.5,标签=arep)
文本(x=0.4,y=0.5,标签=brep)

尽管这是一种解决方法,但至少这是可行的:

arep <- rep('a', 17) %>% 
  str_c(collapse = "\n")
brep <- c(rep('b', 10), rep("", 7)) %>% 
  str_c(collapse = "\n")

plot.new()
text(x = .5, y = .5, labels = arep)
text(x = .4, y = .5, labels = brep)
arep%
str_c(collapse=“\n”)
布雷普%
str_c(collapse=“\n”)
plot.new()
文本(x=0.5,y=0.5,标签=arep)
文本(x=0.4,y=0.5,标签=brep)