Alpha keyword ignored in scatterlines

MWE:

using CairoMakie

set_theme!(theme_latexfonts())
update_theme!(
    palette=(color=ColorSchemes.glasbey_category10_n256.colors,),
    ScatterLines=(cycle=Cycle(:color),)
)

function main()
    f = Figure()
    ax = Axis(f[1, 1])

    for i in 1:1
        scatterlines!(ax, 0:127, rand(128), label=string(i), alpha=0.5)
        lines!(ax, 0:127, rand(128), label=string(i), alpha=0.5)
    end

    Legend(f[1, 2], ax, "Some Title", framevisible=false)
    ax.xlabel = "x-axis"
    ax.ylabel = "y-axis"

    resize_to_layout!(f)
    display(f)
end

main()

It seems like the alpha keyword is possibly ignored in scatterlines? Or perhaps I am doing something wrong again. The same thing happens in a fresh julia session after commenting out the lines to do with theming.

It’s always good to take the “M” in MWE seriously to make life easy for others. In this case you probably want:

scatterlines(rand(10); alpha = 0.1)

which indeed doesn’t work. There’s a bit of alpha whack-a-mole in the Makie repo:

So feel free to add your issue I guess? Maybe @jules @sdanisch have other plans on how to deal with this more generally?

Thanks for the tip, I’ll have to remind myself what minimal means lol. Unfortunate to see this is an issue in other parts of Makie as well

I think you can use

scatterlines(rand(10), color=(Makie.wong_colors()[1],0.5))

Unfortunately, you cannot use color=(Cycled(1),0.5), but I think there was an issue already opened for this.

1 Like

Thank you, your suggestion works well! I was able to use it with ColorSchemes.glasbey_category10_n256.colors[i], 0.7