【发布时间】:2025-12-21 17:25:16
【问题描述】:
我正在用 geom_text_repel 库绘制 ggplot。 x 轴是个人 ID,y 轴是连续值。
如何在 x 轴的每个步骤中添加标签最小 y 值。 这是我的简单代码。
dummy_plot = ggplot(data = summary_mmdata ,
aes(x = factor(type),y = WER_Value,
linetype=factor(WER_Type),
shape = factor(method),
group =factor(WER_Type):factor(method)
)) +
geom_line()+
geom_point()+
scale_y_log10()+
scale_shape_discrete(name = "",
labels=c("Test_Distance"="D1","Test_DistanceV2"="D2T",
"Test_DistanceV2MAV"="D2M","Test_DistanceV2Skip2"="D2S",
"Test_HeatMap"="HM"))+
ylab("AER")+
xlab("")+
geom_text_repel(
data = subset(summary_mmdata, WER_Value == min(WER_Value)),
aes(label = WER_Value),
size = 5,
box.padding = unit(0.35, "lines"),
point.padding = unit(0.3, "lines")
)
dummy_plot
【问题讨论】: