# Increasing the markersize of the legend

**URL:** <https://discourse.julialang.org/t/increasing-the-markersize-of-the-legend/81928>\
**Category:** General Usage\
**Tags:** question, plotting, makie\
**Created:** [May 30, 2022, 6:45pm UTC](https://discourse.julialang.org/t/increasing-the-markersize-of-the-legend/81928 "2022-05-30T18:45:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [May 30, 2022, 6:45pm UTC](https://discourse.julialang.org/t/increasing-the-markersize-of-the-legend/81928/1 "2022-05-30T18:45:09Z")

</div>

In Makie, how do you increase the markersize of the legend, even though the markersize used in the plot is small?

I have a scatter plot with many points so I set a small marker size. But the same markersize in the legend is too small to see.

I am using `axislegend` to construct the legend, so ideally a setting with that function would be neat.

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [June 9, 2024, 12:12pm UTC](https://discourse.julialang.org/t/increasing-the-markersize-of-the-legend/81928/2 "2024-06-09T12:12:38Z")

</div>

Sorry to revive this, but I never got a reply. Would be nice to have a way to control the marker size in the legend.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [June 9, 2024, 3:24pm UTC](https://discourse.julialang.org/t/increasing-the-markersize-of-the-legend/81928/3 "2024-06-09T15:24:06Z")

</div>

I only have this hack using internals currently

```julia
f, ax, _ = scatter(randn(10000, 2), markersize = 1, color = :red, label = "Reds")
scatter!(randn(10000, 2) .+ 5, markersize = 1, color = :blue, label = "Blues")
leg = Legend(f[1, 2], ax)
for i in 1:2
   leg.entrygroups[][1][2][i].elements[1].attributes[:markersize] = Observable(20)
end
notify(leg.entrygroups)
f

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/b/eb782ca0e8525f3fbfcbce3b7ef3fd6a70226f12.png)

---

<div class="post-metadata">

**Author:** ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Post date:** [June 9, 2024, 5:18pm UTC](https://discourse.julialang.org/t/increasing-the-markersize-of-the-legend/81928/4 "2024-06-09T17:18:58Z")

</div>

You could do this without a hack by creating “dummy” plots:

```julia
f, ax, _ = scatter(randn(10000, 2), markersize = 1, color = :red)
scatter!(randn(10000, 2) .+ 5, markersize = 1, color = :blue,)
scatter_red = scatter!([], markersize = 20, color = :red, label = "Reds")
scatter_blue = scatter!([], markersize = 20, color = :blue, label = "Blues")
leg = Legend(f[1, 2], [scatter_red, scatter_blue])
f

```

---

<div class="post-metadata">

**Author:** ![evansenvy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evansenvy/32/209769_2.png) [@evansenvy](https://discourse.julialang.org/u/evansenvy)\
**Post date:** [June 11, 2024, 5:36am UTC](https://discourse.julialang.org/t/increasing-the-markersize-of-the-legend/81928/5 "2024-06-11T05:36:35Z")

</div>

Hello,  
To increase the marker size of the legend in Makie while keeping the plot markers small, adjust the `markersize` property of the legend markers after creating the legend. There’s no direct setting in `axislegend`, but you can achieve it like this  
legend\_marker\_size = 10 # Adjust as needed  
legend\_scatter = scatter([NaN], [NaN], markersize = legend\_marker\_size, color = :black, label = “Legend”)  
axislegend(scatterplot, legend\_scatter)

for marker in legend\_scatter  
marker.markersize = legend\_marker\_size  
I hope this will help you,  
Thank you
