Colour next to the label in the legend of a mesh3d in Plots.jl

Why the colour of the surfaces does not appear next to the text label in the legend box when I use the code below ? How to have it appear ?

x = [0, 0, 0, 0, 1, 1, 1, 1]
y = [0, 0, 1, 1, 0, 0, 1, 1]
z = [0, 1, 0, 1, 0, 1, 0, 1]
sqconnections = [(1,2,4,3),(5,6,8,7),(1,5,6,2),(3,7,8,4),(2,4,8,6),(1,3,7,5)];

Plots.plot(seriestype=:mesh3d, x, y, z,
connections=sqconnections,
linecolor=:black,
labels = "why no colours :(",
show=true)

I tried to look for possible series attributes but could not find anything.

A simple workaround:

plot(seriestype=:mesh3d, x, y, z,
    connections=sqconnections,
    linecolor=:black, fc=:skyblue,
    labels=""
)

plot!((NaN,0,0), lc=:transparent, fc=:skyblue, marker=:square, labels="Sky blue", widen=false)
1 Like