# Plots.jl white marker with coloured stroke

**URL:** <https://discourse.julialang.org/t/plots-jl-white-marker-with-coloured-stroke/104888>\
**Category:** Visualization\
**Tags:** plots\
**Created:** [October 12, 2023, 9:22am UTC](https://discourse.julialang.org/t/plots-jl-white-marker-with-coloured-stroke/104888 "2023-10-12T09:22:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![abehersan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abehersan/32/47221_2.png) [@abehersan](https://discourse.julialang.org/u/abehersan)\
**Post date:** [October 12, 2023, 9:22am UTC](https://discourse.julialang.org/t/plots-jl-white-marker-with-coloured-stroke/104888/1 "2023-10-12T09:22:46Z")

</div>

Using the GR backend, I would like to have scatter plots where the inside of the markers are white whilst the edge/stroke is the color of the current palette.

The problem is that setting `markercolor=:white` will also make the edge white if `markerstrokecolor=:auto` is set.

MWE:

```julia
begin
using Plots
gr()
# this will show 100 random points that are white with white stroke
scatter(rand(100), markercolor=:white, markerstrokewidth=1.7, markerstrokecolor=:auto)
end

```

Thanks in advance for any ideas! (:

---

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [October 12, 2023, 5:46pm UTC](https://discourse.julialang.org/t/plots-jl-white-marker-with-coloured-stroke/104888/2 "2023-10-12T17:46:09Z")

</div>

It seems that this is impossible, according to this open issue: [How to plot unfilled markers? · Issue #2338 · JuliaPlots/Plots.jl · GitHub](https://github.com/JuliaPlots/Plots.jl/issues/2338)  
With PlotlyJS you can plot such markers, as follows:

```julia
using PlotlyJS
x= 1:20
y=1 .+2*rand(20)
pl = Plot(scatter(x=x, y=y, mode="markers", marker=attr(color=y, 
                symbol="circle-open", line_width=2,
                size=8.5, showscale=true)), Layout(width=500, height=360, 
        #template=:plotly_white
        ))

```

![open-circles](https://global.discourse-cdn.com/julialang/original/3X/7/8/78aebcc8da30a44a2f0e66a5ba5b214a0dbc820e.png)  
Uncommenting `template=:plotly_white`, the background is removed, as well as the default colorscheme. In the former case it was `:plasma`, while in the latter, `:matter`.

---

<div class="post-metadata">

**Author:** ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)\
**Post date:** [October 12, 2023, 6:26pm UTC](https://discourse.julialang.org/t/plots-jl-white-marker-with-coloured-stroke/104888/3 "2023-10-12T18:26:51Z")

</div>

> [@abehersan](#):
>
> if `markerstrokecolor=:auto`

setting `markerstrokecolor = :black` works though

---

<div class="post-metadata">

**Author:** ![abehersan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abehersan/32/47221_2.png) [@abehersan](https://discourse.julialang.org/u/abehersan)\
**Post date:** [October 12, 2023, 6:52pm UTC](https://discourse.julialang.org/t/plots-jl-white-marker-with-coloured-stroke/104888/4 "2023-10-12T18:52:21Z")

</div>

This is exactly the workaround I have been using. Thanks!

Only downside is that the color of the markers has to be specified on a per-function-call basis.

---

<div class="post-metadata">

**Author:** ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)\
**Post date:** [October 12, 2023, 7:22pm UTC](https://discourse.julialang.org/t/plots-jl-white-marker-with-coloured-stroke/104888/5 "2023-10-12T19:22:27Z")

</div>

You can also set

```julia
default( markerstrokecolor = :black )

```

---

<div class="post-metadata">

**Author:** ![abehersan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abehersan/32/47221_2.png) [@abehersan](https://discourse.julialang.org/u/abehersan)\
**Post date:** [November 11, 2023, 3:49pm UTC](https://discourse.julialang.org/t/plots-jl-white-marker-with-coloured-stroke/104888/6 "2023-11-11T15:49:11Z")

</div>

Just for completeness, here is a MWE of how to color only the stroke of the markers: whilst keeping their color white:

```julia
begin
        using Plots
        x = 0:0.1:2pi
        y1 = sin.(x)
        y2 = cos.(x)
        scatter(x, y1, mc=:white, msc=1)
        scatter!(x, y2, mc=:white, msc=2)
end

```
