我尝试在 ggplot2 库中添加 ggrepel 来绘制图形:
set.seed(42)
ggplot(mtcars) +
geom_point(aes(wt, mpg), size = 5, color = 'grey') +
geom_label_repel(aes(wt, mpg, fill = factor(cyl), label = rownames(mtcars)),
fontface = 'bold', color = 'white',
box.padding = 0.35, point.padding = 0.5,
segment.color = 'grey50') +
theme_classic(base_size = 16)
但我收到以下错误:
Error in convertUnit(x, unitTo, "x", "dimension", "x", "dimension", valueOnly = valueOnly) : 'x' argument must be a unit object
谢谢?