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] areaplot! failing with layout #4898

Open
Iddingsite opened this issue Feb 29, 2024 · 0 comments
Open

[BUG] areaplot! failing with layout #4898

Iddingsite opened this issue Feb 29, 2024 · 0 comments
Labels

Comments

@Iddingsite
Copy link

Details

areaplot! cannot be used with layout:

using Plots

x = 1:3
y = [1 2 3; 7 8 9; 4 5 6]

hdl = plot(framestyle=:box, layout=(2,1))
plot!(hdl[1], title="test")
plot!(hdl[2], title="test")
scatter!(hdl[1], x, y, seriescolor = [:red :green :blue])
areaplot!(hdl[1], x, y, seriescolor = [:red :green :blue], fillalpha = [0.2 0.3 0.4])

This fails at the areaplot! line:

ERROR: Cannot convert Plots.Subplot{Plots.GRBackend} to series data for plotting
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] _prepare_series_data(x::Plots.Subplot{Plots.GRBackend})
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/series.jl:8
  [3] _series_data_vector(x::Plots.Subplot{Plots.GRBackend}, plotattributes::Dict{Symbol, Any})
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/series.jl:36
  [4] macro expansion
    @ ~/.julia/packages/RecipesPipeline/BGM3l/src/series.jl:128 [inlined]
  [5] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, ::Type{RecipesPipeline.SliceIt}, x::Any, y::Any, z::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesBase/BRe07/src/RecipesBase.jl:300
  [6] _process_userrecipes!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/user_recipe.jl:38
  [7] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/RecipesPipeline.jl:72
  [8] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
    @ Plots ~/.julia/packages/Plots/HyyIK/src/plot.jl:223
  [9] plot!(plt::Plots.Plot, args::Any; kw...)
    @ Plots ~/.julia/packages/Plots/HyyIK/src/plot.jl:213
 [10] plot!(args::Any; kw...)
    @ Plots ~/.julia/packages/Plots/HyyIK/src/plot.jl:202
 [11] areaplot!(::Any, ::Vararg{Any}; kw...)
    @ Plots ~/.julia/packages/RecipesBase/BRe07/src/RecipesBase.jl:382
 [12] top-level scope
    @ ~/Documents/Programming/Test_nico/plots_areaplot.jl:8

Although, this works:

l = @layout [a ; b]

p1 = plot(title="test")
p1 = scatter!(p1, x, y)
p1 = areaplot!(p1, x, y)

p2 = plot(title="test")

plot(p1, p2, layout=l)

Capture d’écran 2024-02-29 à 15 09 41

Maybe the first way of plotting is not recommended?

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.10) pkg> status Plots
Status `~/.julia/environments/v1.10/Project.toml`
  [91a5bcdd] Plots v1.40.1

Backend version (]st -m <backend(s)>):

Status `~/.julia/environments/v1.10/Manifest.toml`
  [28b8d3ca] GR v0.73.2

Output of versioninfo():

Julia Version 1.10.1
Commit 7790d6f0641 (2024-02-13 20:41 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (x86_64-apple-darwin22.4.0)
  CPU: 16 × Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 16 default, 0 interactive, 8 GC (on 16 virtual cores)
@Iddingsite Iddingsite added the bug label Feb 29, 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