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] Heatmap with DateTime x-axis causes error #4895

Open
hagi123456 opened this issue Feb 27, 2024 · 0 comments
Open

[BUG] Heatmap with DateTime x-axis causes error #4895

hagi123456 opened this issue Feb 27, 2024 · 0 comments
Labels

Comments

@hagi123456
Copy link

Details

I want to create a heatmap with DateTime axis as for example shown in the Plots documentation:

using Plots
plotlyjs()
using Dates
heatmap(DateTime.(2016:2020), 1:5, rand(5, 5))

Unfortunately, this causes an error.

Error showing value of type Plots.Plot{Plots.PlotlyJSBackend}:
ERROR: MethodError: no method matching -(::String, ::String)
Stacktrace:
  [1] __heatmap_edges(v::Vector{String}, isedges::Bool, ispolar::Bool)
    @ Plots ~/.julia/packages/Plots/HyyIK/src/utils.jl:244
  [2] _heatmap_edges(::Val{true}, v::Vector{String}, ::Symbol, isedges::Bool, ispolar::Bool)
    @ Plots ~/.julia/packages/Plots/HyyIK/src/utils.jl:249
  [3] heatmap_edges(v::Vector{String}, scale::Symbol, isedges::Bool, ispolar::Bool)
    @ Plots ~/.julia/packages/Plots/HyyIK/src/utils.jl:258
  [4] plotly_series(plt::Plots.Plot{Plots.PlotlyJSBackend}, series::Plots.Series)
    @ Plots ~/.julia/packages/Plots/HyyIK/src/backends/plotly.jl:596
  [5] #653
    @ ./none:0 [inlined]
  [6] MappingRF
    @ ./reduce.jl:100 [inlined]
  [7] _foldl_impl(op::Base.MappingRF{Plots.var"#653#654"{…}, Base.BottomRF{…}}, init::Base._InitialValue, itr::Vector{Plots.Series})
    @ Base ./reduce.jl:58
  [8] foldl_impl
    @ ./reduce.jl:48 [inlined]
  [9] mapfoldl_impl
    @ ./reduce.jl:44 [inlined]
 [10] mapfoldl
    @ ./reduce.jl:175 [inlined]
 [11] mapreduce
    @ ./reduce.jl:307 [inlined]
 [12] reduce
    @ ./reduce.jl:490 [inlined]
 [13] plotly_series
    @ ~/.julia/packages/Plots/HyyIK/src/backends/plotly.jl:1045 [inlined]
 [14] plotlyjs_syncplot(plt::Plots.Plot{Plots.PlotlyJSBackend})
    @ Plots ~/.julia/packages/Plots/HyyIK/src/backends/plotlyjs.jl:10
 [15] _display(plt::Plots.Plot{Plots.PlotlyJSBackend})
    @ Plots ~/.julia/packages/Plots/HyyIK/src/backends/plotlyjs.jl:44
 [16] display(::Plots.PlotsDisplay, plt::Plots.Plot{Plots.PlotlyJSBackend})
    @ Plots ~/.julia/packages/Plots/HyyIK/src/output.jl:169
 [17] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:340
 [18] #invokelatest#2
    @ Base ./essentials.jl:887 [inlined]
 [19] invokelatest
    @ Base ./essentials.jl:884 [inlined]
 [20] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL /opt/julia/julia-1.10.0/share/julia/stdlib/v1.10/REPL/src/REPL.jl:315
 [21] (::REPL.var"#57#58"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL /opt/julia/julia-1.10.0/share/julia/stdlib/v1.10/REPL/src/REPL.jl:284
 [22] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /opt/julia/julia-1.10.0/share/julia/stdlib/v1.10/REPL/src/REPL.jl:569
 [23] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL /opt/julia/julia-1.10.0/share/julia/stdlib/v1.10/REPL/src/REPL.jl:282
 [24] (::REPL.var"#do_respond#80"{})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL /opt/julia/julia-1.10.0/share/julia/stdlib/v1.10/REPL/src/REPL.jl:911
 [25] #invokelatest#2
    @ Base ./essentials.jl:887 [inlined]
 [26] invokelatest
    @ Base ./essentials.jl:884 [inlined]
 [27] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit /opt/julia/julia-1.10.0/share/julia/stdlib/v1.10/REPL/src/LineEdit.jl:2656
 [28] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL /opt/julia/julia-1.10.0/share/julia/stdlib/v1.10/REPL/src/REPL.jl:1312
 [29] (::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL /opt/julia/julia-1.10.0/share/julia/stdlib/v1.10/REPL/src/REPL.jl:386
Some type information was truncated. Use `show(err)` to see complete types.

Backends

This bug occurs on ( insert x below )

Backend yes no untested
gr (default) x
pythonplot x
plotlyjs x
pgfplotsx x though the xticks are wrong; could be just unix epochs
unicodeplots x
inspectdr x
gaston x

Versions

Plots.jl version: v1.40.1
Backend version:

  • Plotly v0.4.1
  • PlotlyJS v0.18.13
    Output of versioninfo():
Julia Version 1.10.0
Commit 3120989f39b (2023-12-25 18:01 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 × AMD Ryzen 5 3600 6-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, znver2)
  Threads: 17 on 12 virtual cores
@hagi123456 hagi123456 added the bug label Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant