# Annotating only a few points with StatsPlots

**URL:** <https://discourse.julialang.org/t/annotating-only-a-few-points-with-statsplots/112635>\
**Category:** Visualization\
**Created:** [April 7, 2024, 9:34am UTC](https://discourse.julialang.org/t/annotating-only-a-few-points-with-statsplots/112635 "2024-04-07T09:34:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlshew19](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlshew19/32/38751_2.png) [@dlshew19](https://discourse.julialang.org/u/dlshew19)\
**Post date:** [April 7, 2024, 9:34am UTC](https://discourse.julialang.org/t/annotating-only-a-few-points-with-statsplots/112635/1 "2024-04-07T09:34:34Z")

</div>

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.

 ![Screenshot 2024-04-07 at 4.27.58 AM](https://global.discourse-cdn.com/julialang/original/3X/f/8/f8537fd5a0b00462d30ebbb71722e447bcda0406.png)

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

```julia
@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?

![SpdPAOBPStealsScatter](https://global.discourse-cdn.com/julialang/original/3X/5/9/594f062b2c7c00fe36cb07ba3a56f38c483efe12.png)

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [April 7, 2024, 9:50am UTC](https://discourse.julialang.org/t/annotating-only-a-few-points-with-statsplots/112635/2 "2024-04-07T09:50:09Z")

</div>

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.)
