JuliaStats / TimeSeries.jl

Time series toolkit for Julia
Other
352 stars 69 forks source link

Label is ignored in plot #430

Closed ValentinKaisermayer closed 4 years ago

ValentinKaisermayer commented 5 years ago

If a TimeArray is plotted the label argument of plot seems to be ignored.

using TimeSeries
using Dates
using Plots

dates = Date(2018, 1, 1):Day(1):Date(2018, 12, 31)
ta = TimeArray(dates, rand(length(dates)), [:rand])

p = plot(ta, label="new label")

Thanks!

ValentinKaisermayer commented 4 years ago

The problem seems to be here: https://github.com/JuliaStats/TimeSeries.jl/blob/8b00a78cf276948d3a57980356340b289d8e5156/src/plotrecipes.jl#L10

iblislin commented 4 years ago

oh, so we can make it as a default to allow user-defined value.

@ohmsweetohm1 Could you make a PR and test it?

I guess it will be:

labels -> get(plotattributes, :label, reshape(String.(colnames(ta)),1,length(colnames(ta))) )