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] surface and contour comment-behavior inconsistency for equal length lists #5042

Open
aavogt opened this issue Jan 26, 2025 · 0 comments
Labels

Comments

@aavogt
Copy link

aavogt commented Jan 26, 2025

using Plots
using SplitApplyCombine

x = y = 0:0.1:10
xyz = invert([[x, y, sin(x) * cos(y)] for x in x for y in y][:])

savefig(Plots.surface(xyz[1], xyz[2], xyz[3]), "ok.pdf")
savefig(Plots.contour(xyz[1], xyz[2], xyz[3]), "error.pdf")
ERROR: Arrays have incorrect length or dimension.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] contour(px::Vector{Float64}, py::Vector{Float64}, h::Vector{Float64}, pz::Vector{Float64}, major_h::Int64)
    @ GR ~/.julia/packages/GR/qPXg9/src/GR.jl:2647
  [3] gr_draw_contour(series::Plots.Series, x::Vector{Float64}, y::Vector{Float64}, z::Vector{Float64}, clims::Tuple{Float64, Float64})
    @ Plots ~/.julia/packages/Plots/Ec1L1/src/backends/gr.jl:1928
  [4] gr_add_series(sp::Plots.Subplot{Plots.GRBackend}, series::Plots.Series)
    @ Plots ~/.julia/packages/Plots/Ec1L1/src/backends/gr.jl:1778
  [5] gr_display(sp::Plots.Subplot{Plots.GRBackend}, w::Measures.AbsoluteLength, h::Measures.AbsoluteLength, vp_canvas::Plots.GRViewport{Float64})
    @ Plots ~/.julia/packages/Plots/Ec1L1/src/backends/gr.jl:964
  [6] (::Plots.var"#508#509"{Int64, Int64, Plots.GRViewport{Float64}})(sp::Plots.Subplot{Plots.GRBackend})
    @ Plots ~/.julia/packages/Plots/Ec1L1/src/backends/gr.jl:688
  [7] foreach(f::Plots.var"#508#509"{Int64, Int64, Plots.GRViewport{Float64}}, itr::Vector{Plots.Subplot})
    @ Base ./abstractarray.jl:3187
  [8] gr_display(plt::Plots.Plot{Plots.GRBackend}, dpi_factor::Int64)
    @ Plots ~/.julia/packages/Plots/Ec1L1/src/backends/gr.jl:688
  [9] #555
    @ ~/.julia/packages/Plots/Ec1L1/src/backends/gr.jl:2086 [inlined]
 [10] withenv(::Plots.var"#555#556"{Plots.Plot{Plots.GRBackend}, Int64}, ::Pair{String, String}, ::Vararg{Pair{String, String}})
    @ Base ./env.jl:265
 [11] _show(io::IOStream, ::MIME{Symbol("application/pdf")}, plt::Plots.Plot{Plots.GRBackend})
    @ Plots ~/.julia/packages/Plots/Ec1L1/src/backends/gr.jl:2081
 [12] #invokelatest#2
    @ ./essentials.jl:1055 [inlined]
 [13] invokelatest
    @ ./essentials.jl:1052 [inlined]
 [14] show
    @ ~/.julia/packages/Plots/Ec1L1/src/output.jl:232 [inlined]
 [15] #350
    @ ~/.julia/packages/Plots/Ec1L1/src/output.jl:27 [inlined]
 [16] open(::Plots.var"#350#351"{Plots.Plot{Plots.GRBackend}}, ::String, ::Vararg{String}; kwargs::@Kwargs{})
    @ Base ./io.jl:410
 [17] open
    @ ./io.jl:407 [inlined]
 [18] pdf(plt::Plots.Plot{Plots.GRBackend}, fn::String)
    @ Plots ~/.julia/packages/Plots/Ec1L1/src/output.jl:27
 [19] savefig(plt::Plots.Plot{Plots.GRBackend}, fn::String)
    @ Plots ~/.julia/packages/Plots/Ec1L1/src/output.jl:149
 [20] top-level scope
    @ none:1

Details

The comments in my GR.jl suggest that contour should succeed while surface should fail here. But it's the opposite.

contour

`x` :
    A list containing the X coordinates
`y` :
    A list containing the Y coordinates
`h` :
    A list containing the Z coordinate for the height values

surface

`x` :
    A list containing the X coordinates
`y` :
    A list containing the Y coordinates
`z` :
    A list of length `len(x)` * `len(y)` or an appropriately dimensioned
    array containing the Z coordinates

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:
Backend version (]st -m <backend(s)>):
Output of versioninfo():

 [91a5bcdd] Plots v1.40.9
julia> versioninfo()
Julia Version 1.11.3
Commit d63adeda50d (2025-01-21 19:42 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × 13th Gen Intel(R) Core(TM) i7-13620H
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, goldmont)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)

@aavogt aavogt added the bug label Jan 26, 2025
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