# Filtering keypoints to be plotted

**URL:** <https://community.ultralytics.com/t/filtering-keypoints-to-be-plotted/873>\
**Category:** Support\
**Tags:** question, tips-n-tricks\
**Created:** [March 21, 2025, 7:15pm UTC](https://community.ultralytics.com/t/filtering-keypoints-to-be-plotted/873 "2025-03-21T19:15:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TedalS](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/tedals/32/642_2.png) [@TedalS](https://community.ultralytics.com/u/TedalS)\
**Post date:** [March 21, 2025, 7:15pm UTC](https://community.ultralytics.com/t/filtering-keypoints-to-be-plotted/873/1 "2025-03-21T19:15:01Z")

</div>

I’m using yolo11n-pose to identify keypoints in a video of a person’s face. It’s flagging keypoints for the nose, eyes, and ears, as shown in the image below:

 ![image](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/1X/745d37b2b11c8c07a33fcf84530f3b1ff663a4a0.jpeg)

I’m trying to figure out how to generate a visualization that only shows the keypoints for the eyes and nose. (#s 0, 1, and 2, I believe?)

[simplified] My code is as follows:

```python
results = model(vid_source)
r.show(kpt_line=False)

```

To get at the keypoints in question, I indexed into `results.keypoints.xy[0][0:3]` and got the subset of results I was expecting, but I can’t figure out how to do the same for the object getting passed to the plotting utility.

```auto

```

---

<div class="post-metadata">

**Author:** ![BurhanQ](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/burhanq/32/7_2.png) [@BurhanQ](https://community.ultralytics.com/u/BurhanQ)\
**Post date:** [March 22, 2025, 2:16am UTC](https://community.ultralytics.com/t/filtering-keypoints-to-be-plotted/873/2 "2025-03-22T02:16:55Z")

</div>

There isn’t a direct way to accomplish this with the `.plot()` method. You could use a bit of a roundabout way manually

```python
from copy import deepcopy

from ultralytics import YOLO
from ultralytics.utils.plotting import Annotator, colors

# Using all default config values
line_width = None
font = "Arial.ttf"
font_size = None
kpt_radius = 5
kpt_line = False
color_mode = "instance"

model = YOLO("yolo11n-pose.pt")

src = "" # update as needed
results = model.predict(src)

for result in results:
    annotator = Annotator(
        deepcopy(result.orig_img), # could use frame if iterating
        line_width,
        font_size,
        font,
        example=model.names,
    )
    for i, k in enumerate(reversed(results.keypoints.data)):
        annotator.kpts(
            k[:3], # might have to adjust as needed
            results.orig_shape,
            radius=kpt_radius,
            kpt_line=kpt_line,
            kpt_color=colors(i, True) if color_mode == "instance" else None,
    )
    annotator.show(result.path)

```

Ripped out from [here](https://github.com/ultralytics/ultralytics/blob/3aba4203f9d489bdb2f42f02eecb233fcf25a755/ultralytics/engine/results.py#L576-L585) and you can see more details about the [`Annotator` class here](https://docs.ultralytics.com/reference/utils/plotting/#ultralytics.utils.plotting.Annotator).
