有谁知道\xe2\x80\x99s是否可以在ggplot2 538\xe2\x80\x99s中复制绘图中概述文本的功能?
\n在所附的例子中。是否可以将圆形白色轮廓添加到百分比中?
\n\n一种选择是Shadowtext包,第二种选择是ggrepel:
library(ggplot2)
library(shadowtext)
df <- data.frame(
x = factor(1),
y = factor(1),
label = "78%"
)
ggplot(df, aes(x = x, y = y, label = label)) +
geom_tile(fill = "firebrick") +
geom_shadowtext(color = "black", size = 14 / .pt, fontface = "bold", bg.colour = "white", bg.r = .2) +
theme_void()
Run Code Online (Sandbox Code Playgroud)

library(ggrepel)
ggplot(df, aes(x = x, y = y, label = label)) +
geom_tile(fill = "firebrick") +
geom_text_repel(color = "black", size = 14 / .pt, fontface = "bold", bg.colour = "white", bg.r = .2, force = 0) +
theme_void()
Run Code Online (Sandbox Code Playgroud)
