Modifying the legend of a plot with a colorbar

Hello,

I’m trying to modify the legend of this plot:
image

The plot represents a random walk, which is simply a series of (x,y) coordinates. To indicate position vs time, I applied a gradient color scale to the line using the following plot recipe:

function plot_walk(path::AbstractVector)
    plot(path,
        xlabel = "x",
        ylabel = "y",
        plot_title = "Position",
        linecolor = :darkrainbow,
        line_z = 1:length(path),
        framestyle = :box,
        grid = :false,
    )
end

This plot has everything I want it to have, except that I do not need or want the series label (y1). I tried removing it by adding
legend_position = :none
to my plot recipe, but that removed the color bar and left the series label in place, which is exactly the opposite of what I want. I’ve searched the Plots.jl documentation for other attributes that my provide the ability to snip out that label, but I can’t quite find what I’m looking for.

Any suggestions would be appreciated.
Thanks

The details on my working environment:
Julia v1.10
Visual Studio Code v1.91.1 with Julia language extension v1.83.2
Plots.jl vs 1.40.4 with PlotlyJS v0.18.13 as the backend

1 Like

Usually this is achieved in a recipe with keyword label := false

1 Like

That was exactly it, thank you