Using the following R code all data points are labelled in the line chart, I would like each line labelled only once at the end of each line
ggplot(data = subset(df, !is.na(Q_time_ACU)),
aes(x= P_ID, y= Q_time_ACU, group = run_number, color = run_number)) +
geom_line() +
geom_text_repel(aes(color= run_number, label=run_number),
nudge_x = 1,
na.rm = TRUE)
here is a dput sample:
structure(list(P_ID = c(376L, 428L, 466L, 485L, 395L, 326L, 456L, 272L, 466L, 475L, 180L, 304L, 303L, 385L, 191L, 497L, 260L, 451L, 344L, 359L, 423L, 274L, 230L, 490L, 517L, 209L, 287L, 391L, 327L, 325L), run_number = c(1, 1, 4, 2, 1, 0, 0, 4, 2, 4, 2, 4, 1, 2, 3, 2, 2, 0, 3, 2, 3, 4, 3, 4, 0, 2, 4, 2, 3, 1), Q_time_ACU = c(155.297842905938, 0, 21.4271518946689, 60.3274436437887, 118.8936588416, 0, 1.55912651680092, 0, 128.964632599987, 42.4219509382183, 86.2199178189735, 50.2110239869767, 20.3926736547664, 0, 95.011029120069, 181.809355977849, 11.809349897258, 0, 260.208890079978, 0, 293.343276590466, 9.82926880455261, 23.2166230653593, 0.974429831505859, 0, 0, 0.842701922981178, 0, 235.843120234284, 3.89812978069585)), row.names = c(574L, 611L, 1751L, 1084L, 583L, 149L, 290L, 1568L, 1058L, 1774L, 764L, 1615L, 499L, 984L, 1109L, 1086L, 854L, 280L, 1278L, 938L, 1368L, 1562L, 1141L, 1781L, 353L, 789L, 1574L, 969L, 1262L, 509L), class = "data.frame")