Plotting Series of Shapes

I’d like to plot a series of shapes. I create a vector of shape objects and plot directly. Unlike other series types, each shape is plotted with a different color by default. My hope is that they would all be the same color since they are the same series. How can I fix this without simply specifying the color directly?

ang = range(0, 2π, length = 60)
ellipse(x, y, w, h) = Shape(w*sin.(ang).+x, h*cos.(ang).+y)
myshapes = [ellipse(x,rand(),rand(),rand()) for x = 1:4]
plot(myshapes)

ellipse

Whatever the fix might be, it will certainly not be as simple as simply specifying the color directly…

It could be a recent bug: I used to get a single series with all shapes in blue, but after updating Plots and GR I get multiple series (in different colors as expected).

Changing your last line to …

plot(myshapes,fc=:cornflowerblue)

[fc = fillcolor] leads to:


Is that what you want?

I was pretty sure I used to get all one color too.

It loos like the unexpected behavior was introduced in Plots 1.11.

It’s probably related to this issue: [BUG] Unexpected behavior when plotting seriestype shape + 3x speed regression compared to 1.10.6 · Issue #3384 · JuliaPlots/Plots.jl · GitHub @bmit you might want to add a comment there…

here