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]: linetype=:steppre broken with OffsetArrays #4855

Closed
adityam opened this issue Dec 24, 2023 · 2 comments
Closed

[BUG]: linetype=:steppre broken with OffsetArrays #4855

adityam opened this issue Dec 24, 2023 · 2 comments
Labels

Comments

@adityam
Copy link

adityam commented Dec 24, 2023

Details

linetype=:steppre does not work with OffsetArrays as shown by the following example:

data = OffsetArray(rand(11),-5:5)
plot(data)  # works
plot(data,linetype=:steppre) # fails

The error message is:

BoundsError: attempt to access 11-element OffsetArrays.IdOffsetRange{Int64, Base.OneTo{Int64}} with indices -5:5 at index [6]

Stacktrace:
  [1] throw_boundserror(A::OffsetArrays.IdOffsetRange{Int64, Base.OneTo{Int64}}, I::Tuple{Int64})
    @ Base ./abstractarray.jl:744
  [2] checkbounds
    @ ./abstractarray.jl:709 [inlined]
  [3] getindex
    @ ~/.julia/packages/OffsetArrays/0MOrf/src/axes.jl:224 [inlined]
  [4] make_steps(x::OffsetArrays.IdOffsetRange{Int64, Base.OneTo{Int64}}, st::Symbol, even::Bool)
    @ Plots ~/.julia/packages/Plots/sxUvK/src/recipes.jl:203
  [5] macro expansion
    @ ~/.julia/packages/Plots/sxUvK/src/recipes.jl:216 [inlined]
  [6] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, #unused#::Type{Val{:steppre}}, x::Any, y::Any, z::Any)
    @ Plots ~/.julia/packages/RecipesBase/BRe07/src/RecipesBase.jl:300
  [7] _process_seriesrecipe(plt::Any, plotattributes::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/series_recipe.jl:50
  [8] _process_seriesrecipes!(plt::Any, kw_list::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/series_recipe.jl:27
  [9] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/RecipesPipeline.jl:99
 [10] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
    @ Plots ~/.julia/packages/Plots/sxUvK/src/plot.jl:223
 [11] plot(args::Any; kw::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})
    @ Plots ~/.julia/packages/Plots/sxUvK/src/plot.jl:102
 [12] top-level scope
    @ In[5]:1

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: Plots v1.39.0
Backend version (]st -m <backend(s)>): GR v0.72.10
Output of versioninfo():

Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 × 13th Gen Intel(R) Core(TM) i7-1365U
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, goldmont)
  Threads: 1 on 12 virtual cores
@adityam adityam added the bug label Dec 24, 2023
@isentropic isentropic mentioned this issue Jan 4, 2024
7 tasks
@isentropic
Copy link
Member

Checkout #4860 and see if it works

@isentropic
Copy link
Member

Thanks for reporting @adityam

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

2 participants