【发布时间】:2022-01-15 13:04:45
【问题描述】:
我需要在 ggplot 中为我的文本注释设置一个特定的宽度。例如,我希望第一个注释从x = 0 到x = 40,第二个注释从x = 50 到x = 90。换句话说,我需要使这些注释适合 0 到 40 之间以及 50 到 90 之间的空间。
我还希望文本对齐。
library(ggplot2)
librray(tibble)
df <- tibble(x = 1:100, y = 1:100)
ggplot(df, aes(x = x, y = y))+ geom_blank() +
annotate(geom = 'text', x = 0, y = 50, hjust = 0, vjust = 0,
label = 'Shortly after his arrival at Real Madrid in July 2018, ESPN journalist Dermot Corrigan described Vinícius
as a "zippy left winger or second striker". El Mundo described him "A player who is forever tormented,
teetering on the edge, on that invisible line between genius and ridicule. Judgment always hangs over
him, a winger unable to make his legs and feet move in unison, but he never gives up and that is a great
quality. A versatile player, although he is usually deployed on the left flank, he is capable of playing
anywhere along the front line, and has also been used on the right or in the centre. ',
size = 3,
color ='black')+
annotate(geom = 'text', x = 50, y = 50, hjust = 0, vjust = 0,
label = 'Shortly after his arrival at Real Madrid in July 2018, ESPN journalist Dermot Corrigan described Vinícius
as a "zippy left winger or second striker". El Mundo described him "A player who is forever tormented,
teetering on the edge, on that invisible line between genius and ridicule. Judgment always hangs over
him, a winger unable to make his legs and feet move in unison, but he never gives up and that is a great
quality. A versatile player, although he is usually deployed on the left flank, he is capable of playing
anywhere along the front line, and has also been used on the right or in the centre. ',
size = 3,
color ='black')
ggplot2 有可能吗?有没有其他软件包可以帮助我做到这一点?
【问题讨论】:
-
该代码出现“未使用的参数”错误。
-
@IRTFM 抱歉。我编辑了这个问题。这是字体系列