Plots.jl icon indicating copy to clipboard operation
Plots.jl copied to clipboard

[FR] Way to modify series labels after plot creation.

Open nathanrboyer opened this issue 4 years ago • 3 comments

Currently labels have to be added at the same time the series data is plotted. Other attributes like titles and axis labels can be added and modified after the fact. I would like to be able to add and modify the legend after plot creation also.

Ideally, this would be done in the same way as other attributes like plot!(labels=stringarrayoflabels), but a new function like labels!(stringarrayoflabels) could work too.

This would be most helpful to me when a plot is created within a function, but I want to be able to pretty it up outside of the function to avoid passing a lot of variables back and forth.

nathanrboyer avatar Jul 08 '20 15:07 nathanrboyer

There is no official API, but you can already do this via

p = plot(1:5)
p[1][1][:label] = "label"
p

BeastyBlacksmith avatar Jul 08 '20 19:07 BeastyBlacksmith

Is #2880 supposed to work? The proposed method does not work for me.

singularitti avatar Sep 01 '23 03:09 singularitti

Is #2880 supposed to work? The proposed method does not work for me.

That only worked for some cases, but not in general.

BeastyBlacksmith avatar Sep 01 '23 06:09 BeastyBlacksmith