Annotating only a few points with StatsPlots

Basically I’m trying label the a few of the markers with a name column of my dataframe. I have stats on the x and y axis and I want to label the player who’s it is but I don’t want to crowd the plot. This is how the data frame looks.

The closest I’ve gotten is using this code but it just plots the first 5 name rows over:

@df NormedSteals scatter(:SpdPAOBP, :SB, xlabel="FanGraphs Speed (.50), PA (.35) and OBP (.15) Combo", ylabel="Stolen Bases",
series_annotations=(:Name[1:5], 8))

But I end up with a plot that labels each marker with the first 5 players names annotating every marker. I was wondering if anyone knew the fix to this?


You might use series_annotation=[(i<6 ? :Name[i] : "") for i in eachindex(:Name)]. And maybe there is some function in Iterators that allows to do this more neatly.

(Disclaimer: I have not tested it.)