# Plot image at (x,y) location on scatter plot

**URL:** <https://discourse.julialang.org/t/plot-image-at-x-y-location-on-scatter-plot/78928>\
**Category:** Visualization\
**Created:** [April 3, 2022, 1:39am UTC](https://discourse.julialang.org/t/plot-image-at-x-y-location-on-scatter-plot/78928 "2022-04-03T01:39:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![afishy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/afishy/32/18870_2.png) [@afishy](https://discourse.julialang.org/u/afishy)\
**Post date:** [April 3, 2022, 1:39am UTC](https://discourse.julialang.org/t/plot-image-at-x-y-location-on-scatter-plot/78928/1 "2022-04-03T01:39:09Z")

</div>

Let’s say I’ve done some clustering on my data (like in the image below) and want to show a representative image (i.e. an MxN matrix) from that cluster overlaid at an (x,y) coordinate near that cluster’s center. Is this possible with Plots.jl?

Thank you!

 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/6/e6574baffdc88c7cb2a1cc4797c0a8f9307a4d4e.jpeg)

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [April 3, 2022, 7:31am UTC](https://discourse.julialang.org/t/plot-image-at-x-y-location-on-scatter-plot/78928/2 "2022-04-03T07:31:37Z")

</div>

You could try using `insets`.  
See [one Plots.jl example](https://docs.juliaplots.org/latest/layouts/#Advanced-Layouts) in the docs.

---

<div class="post-metadata">

**Author:** ![yha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yha/32/3502_2.png) [@yha](https://discourse.julialang.org/u/yha)\
**Post date:** [April 3, 2022, 1:05pm UTC](https://discourse.julialang.org/t/plot-image-at-x-y-location-on-scatter-plot/78928/3 "2022-04-03T13:05:52Z")

</div>

You can do a `heatmap!` on top of a scatter plot

```julia
scatter(10 .* rand(40), 20 .* rand(40))
heatmap!(1:5, 6:15, rand(5,10))

```

![plot_280](https://global.discourse-cdn.com/julialang/original/3X/9/3/931fbdd243f5987f0f056c266c52a2764f050752.png)

---

<div class="post-metadata">

**Author:** ![afishy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/afishy/32/18870_2.png) [@afishy](https://discourse.julialang.org/u/afishy)\
**Post date:** [April 4, 2022, 1:42am UTC](https://discourse.julialang.org/t/plot-image-at-x-y-location-on-scatter-plot/78928/4 "2022-04-04T01:42:55Z")

</div>

This works! Thank you 😃
