Marker shapes in Plots

I have to use two marker shapes say: circle and star5, to plot some simulation results via scatter plot. However, the second marker shape, apart from its type, does not appear in plots. I have been trying different ways to code and/or use marker shapes in Plot() and Plot!() functions, but they have not helped me out.

using Plots
MarkerShapes[i,:]= [Plots.supported_markers()[3], Plots.supported_markers()[5]]
for j=1:T
if j==1
My_Plot = plot(X, Y, color = Color[1,1], label = Label[1,1], xlims = (-0.3,0.4), xticks = -0.3:0.05:0.4, markershape = MarkerShapes[1,:], seriestype=:scatter, legend=false)
else
My_Plot = plot!(X, Y, color = Color[1,i], label = Label[1,i], xlims = (-0.3,0.4), xticks = -0.3:0.05:0.4, markershape = MarkerShapes[i,:], seriestype=:scatter, legend=false)
end

This works:

julia> plot()
       for i in 1:10
         if isodd(i)
           scatter!(rand(10),markershape=:circle,label="")
         else
           scatter!(rand(10),markershape=:star5,label="")
         end
       end
       plot!(title="multiple shapes")

ms

1 Like

You can also supply a vector to the markershape.

position = rand(10,2)
markershape = map(i->isodd(i) ? :circle : :star5, 1:length(position))
scatter(position; markershape)
2 Likes