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

Plot quasivector #145

Open
putianyi889 opened this issue Mar 15, 2023 · 5 comments
Open

Plot quasivector #145

putianyi889 opened this issue Mar 15, 2023 · 5 comments

Comments

@putianyi889
Copy link

julia> plot(Inclusion(-1..1))
ERROR: Overload Grid
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] _grid(#unused#::QuasiArrays.PolynomialLayout, P::Inclusion{Float64, IntervalSets.ClosedInterval{Int64}}, n::Int64)
    @ ContinuumArrays C:\Users\pty\.julia\packages\ContinuumArrays\pWRm2\src\bases\bases.jl:154
  [3] grid(P::Inclusion{Float64, IntervalSets.ClosedInterval{Int64}}, n::Int64)
    @ ContinuumArrays C:\Users\pty\.julia\packages\ContinuumArrays\pWRm2\src\bases\bases.jl:170
  [4] _plotgrid(lay::QuasiArrays.PolynomialLayout, P::Inclusion{Float64, IntervalSets.ClosedInterval{Int64}}, n::Int64) (repeats 2 times)
    @ ContinuumArrays C:\Users\pty\.julia\packages\ContinuumArrays\pWRm2\src\plotting.jl:14
  [5] plotgrid(::Inclusion{Float64, IntervalSets.ClosedInterval{Int64}})
    @ ContinuumArrays C:\Users\pty\.julia\packages\ContinuumArrays\pWRm2\src\plotting.jl:13
  [6] plotgridvalues(g::Inclusion{Float64, IntervalSets.ClosedInterval{Int64}})
    @ ContinuumArrays C:\Users\pty\.julia\packages\ContinuumArrays\pWRm2\src\plotting.jl:38
  [7] macro expansion
    @ C:\Users\pty\.julia\packages\ContinuumArrays\pWRm2\src\plotting.jl:43 [inlined]
  [8] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, g::QuasiArrays.AbstractQuasiArray)
    @ ContinuumArrays C:\Users\pty\.julia\packages\RecipesBase\z10lo\src\RecipesBase.jl:300
  [9] _process_userrecipes!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline C:\Users\pty\.julia\packages\RecipesPipeline\XxUHt\src\user_recipe.jl:38
 [10] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline C:\Users\pty\.julia\packages\RecipesPipeline\XxUHt\src\RecipesPipeline.jl:72
 [11] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
    @ Plots C:\Users\pty\.julia\packages\Plots\9Q9pN\src\plot.jl:223
 [12] 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 C:\Users\pty\.julia\packages\Plots\9Q9pN\src\plot.jl:102
 [13] plot(args::Any)
    @ Plots C:\Users\pty\.julia\packages\Plots\9Q9pN\src\plot.jl:93
 [14] top-level scope
    @ REPL[12]:1
@dlfivefifty
Copy link
Member

OK this will take some thought. Essentially it knows its a polynomial. I forget if I implemented the notion of degree but if we did we would be able to know how many points to take in the plotgrid. An evenly spaced grid could be fine here.

@putianyi889
Copy link
Author

I would also want it to work for arbitrary quasivectors, considering them as functions with known domain.

@dlfivefifty
Copy link
Member

Yes that would make sense to have a generic backup with say 1000 points

@putianyi889
Copy link
Author

It could fall back to plotting functions, something like

plot(v::quasivector)=plot(x->v[x])

but I don't know which layer should this be implemented.

@dlfivefifty
Copy link
Member

If you look at sum and sum_layout that auto-expands that gives a possible way of doing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants