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] Can't Plot Multiple Complex Series #4989

Open
bgreber opened this issue Sep 16, 2024 · 0 comments
Open

[BUG] Can't Plot Multiple Complex Series #4989

bgreber opened this issue Sep 16, 2024 · 0 comments
Labels

Comments

@bgreber
Copy link

bgreber commented Sep 16, 2024

Details

Plots has always allowed plotting multiple series in a single call to plot such as:

x = [1;2];
x2 = [3;4];
plot([x x2]);

I have just updated my julia packages for the first time in about a year and found that this no longer works with complex series.
The following code

using Plots;
plotly();

x = [1+0.5im; 0.5+1im];
x2 = [2+2im; 3+3im];
plot([x x2]);

produces

ERROR: MethodError: no method matching isless(::Float64, ::ComplexF64)
Closest candidates are:
  isless(::Real, ::AbstractGray{T} where T) at C:\Users\BGreber\.julia\packages\ColorTypes\vpFgh\src\operations.jl:39
  isless(::AbstractFloat, ::Union{StatsBase.PValue, StatsBase.TestStat}) at C:\Users\BGreber\.julia\packages\StatsBase\ebrT3\src\statmodels.jl:100
  isless(::Real, ::Union{StatsBase.PValue, StatsBase.TestStat}) at C:\Users\BGreber\.julia\packages\StatsBase\ebrT3\src\statmodels.jl:91
  ...
Stacktrace:
  [1] min(x::ComplexF64, y::Float64)
    @ Base .\operators.jl:433
  [2] expand_extrema!
    @ C:\Users\BGreber\.julia\packages\Plots\kLeqV\src\axes.jl:425 [inlined]
  [3] #111
    @ C:\Users\BGreber\.julia\packages\Plots\kLeqV\src\axes.jl:444 [inlined]
  [4] foreach(f::Plots.var"#111#112"{Plots.Extrema}, itr::Vector{ComplexF64})
    @ Base .\abstractarray.jl:2141
  [5] expand_extrema!(axis::Plots.Axis, v::Vector{ComplexF64})
    @ Plots C:\Users\BGreber\.julia\packages\Plots\kLeqV\src\axes.jl:444
  [6] expand_extrema!(sp::Plots.Subplot{Plots.PlotlyBackend}, plotattributes::RecipesPipeline.DefaultsDict)
    @ Plots C:\Users\BGreber\.julia\packages\Plots\kLeqV\src\axes.jl:479
  [7] _expand_subplot_extrema(sp::Plots.Subplot{Plots.PlotlyBackend}, plotattributes::RecipesPipeline.DefaultsDict, st::Symbol)
    @ Plots C:\Users\BGreber\.julia\packages\Plots\kLeqV\src\pipeline.jl:433
  [8] add_series!(plt::Plots.Plot{Plots.PlotlyBackend}, plotattributes::RecipesPipeline.DefaultsDict)
    @ Plots C:\Users\BGreber\.julia\packages\Plots\kLeqV\src\pipeline.jl:376
  [9] _process_seriesrecipe(plt::Any, plotattributes::Any)
    @ RecipesPipeline C:\Users\BGreber\.julia\packages\RecipesPipeline\BGM3l\src\series_recipe.jl:46
 [10] _process_seriesrecipes!(plt::Any, kw_list::Any)
    @ RecipesPipeline C:\Users\BGreber\.julia\packages\RecipesPipeline\BGM3l\src\series_recipe.jl:27
 [11] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline C:\Users\BGreber\.julia\packages\RecipesPipeline\BGM3l\src\RecipesPipeline.jl:99
 [12] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
    @ Plots C:\Users\BGreber\.julia\packages\Plots\kLeqV\src\plot.jl:223

Stacktrace is similar on every backend tested.

Technically you can still do multiple complex series by manually calling plot! for each one, but this is rather cumbersome.

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: v1.40.8
Backend version (]st -m <backend(s)>): Latest versions of all backends as of September 15, 2024
Output of versioninfo():
Julia Version 1.6.4 Commit 35f0c911f4 (2021-11-19 03:54 UTC) Platform Info: OS: Windows (x86_64-w64-mingw32) CPU: AMD Ryzen 7 5800H with Radeon Graphics WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-11.0.1 (ORCJIT, generic)

Edit: Tested again on latest Julia release 1.10.5, still a problem

@bgreber bgreber added the bug label Sep 16, 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