JuliaPlots / Plots.jl

Powerful convenience for Julia visualizations and data analysis
https://docs.juliaplots.org
Other
1.82k stars 352 forks source link

[BUG] histogram doesn't work in Julia 1.6-rc3 with Plotly backend (but works with GR) #3370

Open pgagarinov opened 3 years ago

pgagarinov commented 3 years ago

Details

       using Plots
       plotly()
       y = rand(10, 4)
       x = 1:10
       histogram(x, y, layout = (4, 1))
[ Info: For saving to png with the Plotly backend PlotlyBase has to be installed.
ERROR: UndefRefError: access to undefined reference
Stacktrace:
  [1] getindex
    @ ./array.jl:801 [inlined]
  [2] iterate
    @ ./array.jl:777 [inlined]
  [3] show_json(io::JSON.Writer.CompactContext{IOBuffer}, s::JSON.Serializations.StandardSerialization, x::Vector{Any})
    @ JSON.Writer ~/.julia/packages/JSON/3rsiS/src/Writer.jl:293
  [4] show_pair(io::JSON.Writer.CompactContext{IOBuffer}, s::JSON.Serializations.StandardSerialization, k::Symbol, v::Vector{Any})
    @ JSON.Writer ~/.julia/packages/JSON/3rsiS/src/Writer.jl:241
  [5] show_pair(io::JSON.Writer.CompactContext{IOBuffer}, s::JSON.Serializations.StandardSerialization, kv::Pair{Symbol, Any})
    @ JSON.Writer ~/.julia/packages/JSON/3rsiS/src/Writer.jl:243
  [6] show_json(io::JSON.Writer.CompactContext{IOBuffer}, s::JSON.Serializations.StandardSerialization, x::Dict{Symbol, Any})
    @ JSON.Writer ~/.julia/packages/JSON/3rsiS/src/Writer.jl:271
  [7] #show_json#3
    @ ~/.julia/packages/JSON/3rsiS/src/Writer.jl:325 [inlined]
  [8] show_json
    @ ~/.julia/packages/JSON/3rsiS/src/Writer.jl:324 [inlined]
  [9] print(io::IOBuffer, obj::Dict{Symbol, Any})
    @ JSON.Writer ~/.julia/packages/JSON/3rsiS/src/Writer.jl:349
 [10] plotly_show_js(io::IOBuffer, plot::Plots.Plot{Plots.PlotlyBackend})
    @ Plots ~/.julia/packages/Plots/z5Msu/src/backends/plotly.jl:974
 [11] _show
    @ ./iobuffer.jl:0 [inlined]
 [12] repr(m::MIME{Symbol("application/vnd.plotly.v1+json")}, x::Plots.Plot{Plots.PlotlyBackend}; context::Nothing)
    @ Base.Multimedia ./multimedia.jl:147
 [13] repr
    @ ./multimedia.jl:147 [inlined]
 [14] display(d::VSCodeServer.InlineDisplay, m::MIME{Symbol("application/vnd.plotly.v1+json")}, x::Plots.Plot{Plots.PlotlyBackend})
    @ VSCodeServer ~/.vscode-oss/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/display.jl:47
 [15] display(d::VSCodeServer.InlineDisplay, mime::String, x::Any)
    @ Base.Multimedia ./multimedia.jl:216
 [16] display(d::VSCodeServer.InlineDisplay, x::Plots.Plot{Plots.PlotlyBackend})
    @ VSCodeServer ~/.vscode-oss/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/display.jl:108
 [17] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:328
 [18] #invokelatest#2
    @ ./essentials.jl:708 [inlined]
 [19] invokelatest
    @ ./essentials.jl:706 [inlined]
 [20] (::VSCodeServer.var"#65#69"{Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer ~/.vscode-oss/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/eval.jl:164
 [21] withpath(f::VSCodeServer.var"#65#69"{Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
    @ VSCodeServer ~/.vscode-oss/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/repl.jl:142
 [22] (::VSCodeServer.var"#64#68"{Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer ~/.vscode-oss/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/eval.jl:149
 [23] hideprompt(f::VSCodeServer.var"#64#68"{Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})
    @ VSCodeServer ~/.vscode-oss/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/repl.jl:36
 [24] (::VSCodeServer.var"#63#67"{Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer ~/.vscode-oss/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/eval.jl:117
 [25] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging ./logging.jl:491
 [26] with_logger
    @ ./logging.jl:603 [inlined]
 [27] (::VSCodeServer.var"#62#66"{VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer ~/.vscode-oss/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/eval.jl:183
 [28] #invokelatest#2
    @ ./essentials.jl:708 [inlined]
 [29] invokelatest(::Any)
    @ Base ./essentials.jl:706
 [30] macro expansion
    @ ~/.vscode-oss/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/eval.jl:34 [inlined]
 [31] (::VSCodeServer.var"#60#61")()
    @ VSCodeServer ./task.jl:406

Backends

This bug occurs on ( insert x below )

Backend yes no untested
gr (default) v
pyplot v
plotly v
plotlyjs v
pgfplotsx v
inspectdr v

Versions

Julia: 1.6-rc3 Plots.jl version: v1.11.0 Backend version (]st -m):

(try_plotly_js) pkg> st -m
      Status `~/_Git/_Julia/try_plotly_js/Manifest.toml`
  [79e6a3ab] Adapt v3.2.0
  [bf4720bc] AssetRegistry v0.1.0
  [9e28174c] BinDeps v1.0.2
  [ad839575] Blink v0.12.5
  [35d6a980] ColorSchemes v3.10.2
  [3da002f7] ColorTypes v0.10.12
  [5ae59095] Colors v0.12.6
  [34da2185] Compat v3.25.0
  [d38c429a] Contour v0.5.7
  [9a962f9c] DataAPI v1.6.0
  [864edb3b] DataStructures v0.18.9
  [e2d170a0] DataValueInterfaces v1.0.0
  [ffbed154] DocStringExtensions v0.8.4
  [c87230d0] FFMPEG v0.4.0
  [53c48c17] FixedPointNumbers v0.8.4
  [59287772] Formatting v0.4.2
  [de31a74c] FunctionalCollections v0.5.0
  [28b8d3ca] GR v0.55.0
  [5c1252a2] GeometryBasics v0.3.11
  [42e2da0e] Grisu v1.0.0
  [cd3eb016] HTTP v0.8.19
  [9fb69e20] Hiccup v0.2.2
  [83e8ac13] IniFile v0.5.0
  [c8e1da08] IterTools v1.3.0
  [82899510] IteratorInterfaceExtensions v1.0.0
  [692b3bcd] JLLWrappers v1.2.0
  [97c1335a] JSExpr v0.5.2
  [682c06a0] JSON v0.21.1
  [b964fa9f] LaTeXStrings v1.2.1
  [23fbe1c1] Latexify v0.14.11
  [50d2b5c4] Lazy v0.15.1
  [1914dd2f] MacroTools v0.5.6
  [739be429] MbedTLS v1.0.3
  [442fdcdd] Measures v0.3.1
  [e1d29d7a] Missings v0.4.5
  [ffc61752] Mustache v1.0.10
  [a975b10e] Mux v0.7.5
  [77ba4419] NaNMath v0.3.5
  [510215fc] Observables v0.3.3
  [bac558e1] OrderedCollections v1.4.0
  [69de0a69] Parsers v1.1.0
  [fa939f87] Pidfile v1.2.0
  [ccf2f8ad] PlotThemes v2.0.1
  [995b91a9] PlotUtils v1.0.10
  [58dd65bb] Plotly v0.3.0
  [a03496cd] PlotlyBase v0.5.0
  [f0f68f2c] PlotlyJS v0.14.1
  [91a5bcdd] Plots v1.11.0
  [3cdcf5f2] RecipesBase v1.1.1
  [01d81517] RecipesPipeline v0.3.1
  [189a3867] Reexport v0.2.0
  [ae029012] Requires v1.1.3
  [6c6a2e73] Scratch v1.0.3
  [992d4aef] Showoff v0.3.2
  [a2af1166] SortingAlgorithms v0.3.1
  [90137ffa] StaticArrays v1.0.1
  [2913bbd2] StatsBase v0.33.4
  [09ab397b] StructArrays v0.5.0
  [3783bdb8] TableTraits v1.0.0
  [bd369af6] Tables v1.4.1
  [30578b45] URIParser v0.4.1
  [0f1e0344] WebIO v0.8.15
  [104b5d7c] WebSockets v1.5.9
  [cc8bc4a8] Widgets v0.6.2
  [6e34b625] Bzip2_jll v1.0.6+5
  [83423d85] Cairo_jll v1.16.0+6
  [5ae413db] EarCut_jll v2.1.5+1
  [2e619515] Expat_jll v2.2.7+6
  [b22a6f82] FFMPEG_jll v4.3.1+4
  [a3f928ae] Fontconfig_jll v2.13.1+14
  [d7e528f0] FreeType2_jll v2.10.1+5
  [559328eb] FriBidi_jll v1.0.5+6
  [0656b61e] GLFW_jll v3.3.3+0
  [d2c73de3] GR_jll v0.53.0+0
  [78b55507] Gettext_jll v0.20.1+7
  [7746bdde] Glib_jll v2.59.0+4
  [aacddb02] JpegTurbo_jll v2.0.1+3
  [c1c5ebd0] LAME_jll v3.100.0+3
  [dd4b983a] LZO_jll v2.10.0+3
  [dd192d2f] LibVPX_jll v1.9.0+1
  [e9f186c6] Libffi_jll v3.2.1+4
  [d4300ac3] Libgcrypt_jll v1.8.5+4
  [7e76a0d4] Libglvnd_jll v1.3.0+3
  [7add5ba3] Libgpg_error_jll v1.36.0+3
  [94ce4f54] Libiconv_jll v1.16.0+7
  [4b2f31a3] Libmount_jll v2.34.0+3
  [89763e89] Libtiff_jll v4.1.0+2
  [38a345b3] Libuuid_jll v2.34.0+7
  [e7412a2a] Ogg_jll v1.3.4+2
  [458c3c95] OpenSSL_jll v1.1.1+6
  [91d4177d] Opus_jll v1.3.1+3
  [2f80f16e] PCRE_jll v8.42.0+4
  [30392449] Pixman_jll v0.40.0+0
  [ede63266] Qt_jll v5.15.2+2
  [a2964d1f] Wayland_jll v1.17.0+4
  [2381bf8a] Wayland_protocols_jll v1.18.0+4
  [02c8fc9c] XML2_jll v2.9.11+0
  [aed1982a] XSLT_jll v1.1.33+4
  [4f6342f7] Xorg_libX11_jll v1.6.9+4
  [0c0b7dd1] Xorg_libXau_jll v1.0.9+4
  [935fb764] Xorg_libXcursor_jll v1.2.0+4
  [a3789734] Xorg_libXdmcp_jll v1.1.3+4
  [1082639a] Xorg_libXext_jll v1.3.4+4
  [d091e8ba] Xorg_libXfixes_jll v5.0.3+4
  [a51aa0fd] Xorg_libXi_jll v1.7.10+4
  [d1454406] Xorg_libXinerama_jll v1.1.4+4
  [ec84b674] Xorg_libXrandr_jll v1.5.2+4
  [ea2f1a96] Xorg_libXrender_jll v0.9.10+4
  [14d82f49] Xorg_libpthread_stubs_jll v0.1.0+3
  [c7cfdc94] Xorg_libxcb_jll v1.13.0+3
  [cc61e674] Xorg_libxkbfile_jll v1.1.0+4
  [12413925] Xorg_xcb_util_image_jll v0.4.0+1
  [2def613f] Xorg_xcb_util_jll v0.4.0+1
  [975044d2] Xorg_xcb_util_keysyms_jll v0.4.0+1
  [0d47668e] Xorg_xcb_util_renderutil_jll v0.3.9+1
  [c22f9ab0] Xorg_xcb_util_wm_jll v0.4.1+1
  [35661453] Xorg_xkbcomp_jll v1.4.2+4
  [33bec58e] Xorg_xkeyboard_config_jll v2.27.0+4
  [c5fb5394] Xorg_xtrans_jll v1.4.0+3
  [3161d3a3] Zstd_jll v1.4.8+0
  [0ac62f75] libass_jll v0.14.0+4
  [f638f0a6] libfdk_aac_jll v0.1.6+4
  [b53b4c65] libpng_jll v1.6.37+6
  [f27f6e37] libvorbis_jll v1.3.6+6
  [1270edf5] x264_jll v2020.7.14+2
  [dfaa095f] x265_jll v3.0.0+3
  [d8fb68d0] xkbcommon_jll v0.9.1+5
  [0dad84c5] ArgTools
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8bb1440f] DelimitedFiles
  [8ba89e20] Distributed
  [f43a241f] Downloads
  [7b1f6079] FileWatching
  [b77e0a4c] InteractiveUtils
  [b27032c2] LibCURL
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [ca575930] NetworkOptions
  [44cfe95a] Pkg
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA
  [9e88b42a] Serialization
  [1a1011a3] SharedArrays
  [6462fe0b] Sockets
  [2f01184e] SparseArrays
  [10745b16] Statistics
  [fa267f1f] TOML
  [a4e569a6] Tar
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll
  [deac9b47] LibCURL_jll
  [29816b5a] LibSSH2_jll
  [c8ffd9c3] MbedTLS_jll
  [14a3606d] MozillaCACerts_jll
  [83775a58] Zlib_jll
  [8e850ede] nghttp2_jll
  [3f19e933] p7zip_jll

Output of versioninfo():

Julia Version 1.6.0-rc3
Commit 23267f0d46 (2021-03-16 17:04 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = "/usr/lib/electron/electron"
  JULIA_NUM_THREADS = 8
ajw-free commented 3 years ago

I get a similar histogram error on Julia version 1.5.3 with Plots v1.11.2 and Plotly v0.3.0 on Ubuntu Linux 20.10.

using Plots plotly() y = rand(10, 4) x = 1:10 histogram(x, y, layout = (4, 1))

UndefRefError: access to undefined reference

Stacktrace: [1] getindex at ./array.jl:809 [inlined] [2] iterate at ./array.jl:785 [inlined] [3] show_json(::JSON.Writer.PrettyContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::JSON.Serializations.StandardSerialization, ::Array{Any,1}) at /home/ajw/.julia/packages/JSON/3rsiS/src/Writer.jl:293 [4] #show_json#3 at /home/ajw/.julia/packages/JSON/3rsiS/src/Writer.jl:325 [inlined] [5] print(::Base.GenericIOBuffer{Array{UInt8,1}}, ::Array{Any,1}, ::Int64) at /home/ajw/.julia/packages/JSON/3rsiS/src/Writer.jl:347 [6] sprint(::Function, ::Array{Any,1}, ::Vararg{Any,N} where N; context::Nothing, sizehint::Int64) at ./strings/io.jl:105 [7] sprint at ./strings/io.jl:101 [inlined] [8] json at /home/ajw/.julia/packages/JSON/3rsiS/src/Writer.jl:366 [inlined] [9] plotly_series_json at /home/ajw/.julia/packages/Plots/SVksJ/src/backends/plotly.jl:903 [inlined] [10] plotly_html_body(::Plots.Plot{Plots.PlotlyBackend}, ::Nothing) at /home/ajw/.julia/packages/Plots/SVksJ/src/backends/plotly.jl:951 [11] plotly_html_body at /home/ajw/.julia/packages/Plots/SVksJ/src/backends/plotly.jl:926 [inlined] [12] html_body at /home/ajw/.julia/packages/Plots/SVksJ/src/backends/plotly.jl:908 [inlined] [13] standalone_html(::Plots.Plot{Plots.PlotlyBackend}; title::String) at /home/ajw/.julia/packages/Plots/SVksJ/src/backends/web.jl:7 [14] standalone_html(::Plots.Plot{Plots.PlotlyBackend}) at /home/ajw/.julia/packages/Plots/SVksJ/src/backends/web.jl:7 [15] _show at /home/ajw/.julia/packages/Plots/SVksJ/src/backends/plotly.jl:989 [inlined] [16] show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("text/html")}, ::Plots.Plot{Plots.PlotlyBackend}) at /home/ajw/.julia/packages/Plots/SVksJ/src/output.jl:215 [17] sprint(::Function, ::MIME{Symbol("text/html")}, ::Vararg{Any,N} where N; context::Nothing, sizehint::Int64) at ./strings/io.jl:105 [18] sprint at ./strings/io.jl:101 [inlined] [19] _ijulia_display_dict(::Plots.Plot{Plots.PlotlyBackend}) at /home/ajw/.julia/packages/Plots/SVksJ/src/ijulia.jl:56 [20] display_dict(::Plots.Plot{Plots.PlotlyBackend}) at /home/ajw/.julia/packages/Plots/SVksJ/src/init.jl:77 [21] #invokelatest#1 at ./essentials.jl:710 [inlined] [22] invokelatest at ./essentials.jl:709 [inlined] [23] execute_request(::ZMQ.Socket, ::IJulia.Msg) at /home/ajw/.julia/packages/IJulia/e8kqU/src/execute_request.jl:112 [24] #invokelatest#1 at ./essentials.jl:710 [inlined] [25] invokelatest at ./essentials.jl:709 [inlined] [26] eventloop(::ZMQ.Socket) at /home/ajw/.julia/packages/IJulia/e8kqU/src/eventloop.jl:8 [27] (::IJulia.var"#15#18")() at ./task.jl:356