# Modifying the legend of a plot with a colorbar

**URL:** <https://discourse.julialang.org/t/modifying-the-legend-of-a-plot-with-a-colorbar/117153>\
**Category:** Visualization\
**Tags:** question, plotting, plots, recipe\
**Created:** [July 17, 2024, 5:18pm UTC](https://discourse.julialang.org/t/modifying-the-legend-of-a-plot-with-a-colorbar/117153 "2024-07-17T17:18:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prconlin](https://avatars.discourse-cdn.com/v4/letter/p/b19c9b/32.png) [@prconlin](https://discourse.julialang.org/u/prconlin)\
**Post date:** [July 17, 2024, 5:18pm UTC](https://discourse.julialang.org/t/modifying-the-legend-of-a-plot-with-a-colorbar/117153/1 "2024-07-17T17:18:00Z")

</div>

Hello,

I’m trying to modify the legend of this plot:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/2/429d5d2aefc8a1136d72592c65297faafbaf2025.png)

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:

```julia
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

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [July 17, 2024, 5:33pm UTC](https://discourse.julialang.org/t/modifying-the-legend-of-a-plot-with-a-colorbar/117153/2 "2024-07-17T17:33:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![prconlin](https://avatars.discourse-cdn.com/v4/letter/p/b19c9b/32.png) [@prconlin](https://discourse.julialang.org/u/prconlin)\
**Post date:** [July 17, 2024, 6:04pm UTC](https://discourse.julialang.org/t/modifying-the-legend-of-a-plot-with-a-colorbar/117153/3 "2024-07-17T18:04:44Z")

</div>

That was exactly it, thank you
