Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Failure to plot TimeTypes as series #4777

Open
omus opened this issue Jun 14, 2023 · 2 comments
Open

[BUG] Failure to plot TimeTypes as series #4777

omus opened this issue Jun 14, 2023 · 2 comments

Comments

@omus
Copy link

omus commented Jun 14, 2023

Details

Plotting time types as a series results a failure:

julia> using Plots, Dates

julia> gr()
Plots.GRBackend()

julia> plot([1, 2], [1, 1])

julia> plot([[1, 2]], [[1, 1]])

julia> plot([DateTime(2001), DateTime(2002)], [1, 1])

julia> plot([[DateTime(2001), DateTime(2002)]], [[1, 1]])
ERROR: Cannot convert DateTime to series data for plotting
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] _prepare_series_data(x::DateTime)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/series.jl:8
  [3] _series_data_vector(x::DateTime, plotattributes::Dict{Symbol, Any})
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/series.jl:36
  [4] (::RecipesPipeline.var"#21#24"{Dict{Symbol, Any}})(vi::DateTime)
    @ RecipesPipeline ./none:0
  [5] iterate
    @ ./generator.jl:47 [inlined]
  [6] _series_data_vector(v::Vector{DateTime}, plotattributes::Dict{Symbol, Any})
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/series.jl:51
  [7] #21
    @ ./none:0 [inlined]
  [8] iterate(::Base.Generator{Vector{Vector{DateTime}}, RecipesPipeline.var"#21#24"{Dict{Symbol, Any}}})
    @ Base ./generator.jl:47
  [9] _series_data_vector(v::Vector{Vector{DateTime}}, plotattributes::Dict{Symbol, Any})
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/series.jl:51
 [10] macro expansion
    @ ~/.julia/packages/RecipesPipeline/BGM3l/src/series.jl:128 [inlined]
 [11] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, #unused#::Type{RecipesPipeline.SliceIt}, x::Any, y::Any, z::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesBase/BRe07/src/RecipesBase.jl:300
 [12] _process_userrecipes!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/user_recipe.jl:38
 [13] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/RecipesPipeline.jl:72
 [14] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
    @ Plots ~/.julia/packages/Plots/rz1WP/src/plot.jl:223
 [15] plot(::Any, ::Vararg{Any}; kw::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})
    @ Plots ~/.julia/packages/Plots/rz1WP/src/plot.jl:102
 [16] plot(::Any, ::Any)
    @ Plots ~/.julia/packages/Plots/rz1WP/src/plot.jl:93
 [17] top-level scope
    @ REPL[35]:1

Backends

This bug occurs on ( insert x below )

Backend yes no untested
gr (default) x
pythonplot x
plotlyjs x
pgfplotsx x
unicodeplots x
inspectdr x
gaston x

Versions

Plots.jl version: 1.38.16
Backend version (]st -m <backend(s)>): 0.72.7
Output of versioninfo():

Julia Version 1.8.5
Commit 17cfb8e65e (2023-01-08 06:45 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.6.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
  Threads: 1 on 4 virtual cores
@BeastyBlacksmith
Copy link
Member

Agree, that this should work. But for your use-case, a matrix should do as well (where coulums are series), doesn't it?

@BeastyBlacksmith
Copy link
Member

BeastyBlacksmith commented Jun 28, 2023

To claim this bounty the solution should handle vector of vectors for type recipes in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants