using GLMakie
f = Figure()
ax = Axis(f[:,:])
for i in 1:5
scatter!(
ax, i, i,
marker=collect('a':'z')[i],
colormap=:tab10, colorrange=(1, 10), color=i,
markersize = 15, label = "this is a label"
)
end
axislegend(ax, position=:lt)
You could pass label = Makie.rich("this is a label", color = color_you_want) instead, that should work. But you would have to get the color from the colormap manually.
Thanks @asinghvi17, didn’t know that rich text was an option.
edit: the following seems to do the job:
using GLMakie
f = Figure()
ax = Axis(f[:,:])
for i in 1:5
col = cgrad(:tab10)[i]
scatter!(
ax, i, i,
marker=collect('a':'z')[i],
color=col,
markersize = 15,
label = Makie.rich("this is a label", color = col)
)
end
axislegend(ax, position=:lt)