-
-
Notifications
You must be signed in to change notification settings - Fork 110
Fix Makie recipe to support 3D plots with automatic LScene detection #1079
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -23,6 +23,19 @@ function ensure_plottrait(PT::Type, arg, desired_plottrait_type::Type) | |||||||
end | ||||||||
end | ||||||||
|
||||||||
# Define preferred axis type based on the idxs parameter | ||||||||
function Makie.preferred_axis_type(plot::Plot{<:Tuple{<:SciMLBase.AbstractTimeseriesSolution}}) | ||||||||
if haskey(plot, :idxs) || haskey(plot, :vars) | ||||||||
idxs = haskey(plot, :idxs) ? plot[:idxs][] : (haskey(plot, :vars) ? plot[:vars][] : nothing) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||
if idxs isa Tuple && length(idxs) == 3 | ||||||||
return Makie.LScene | ||||||||
elseif idxs isa AbstractArray && length(idxs) == 3 | ||||||||
return Makie.LScene | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||
end | ||||||||
end | ||||||||
return Makie.Axis | ||||||||
end | ||||||||
|
||||||||
# ## `AbstractTimeseriesSolution` recipe | ||||||||
|
||||||||
# First, we define the standard plot type for timeseries solutions. | ||||||||
|
@@ -138,6 +151,19 @@ end | |||||||
|
||||||||
Makie.plottype(integrator::SciMLBase.DEIntegrator) = Makie.Lines | ||||||||
|
||||||||
# Define preferred axis type for integrator plots | ||||||||
function Makie.preferred_axis_type(plot::Plot{<:Tuple{<:SciMLBase.DEIntegrator}}) | ||||||||
if haskey(plot, :idxs) || haskey(plot, :vars) | ||||||||
idxs = haskey(plot, :idxs) ? plot[:idxs][] : (haskey(plot, :vars) ? plot[:vars][] : nothing) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||
if idxs isa Tuple && length(idxs) == 3 | ||||||||
return Makie.LScene | ||||||||
elseif idxs isa AbstractArray && length(idxs) == 3 | ||||||||
return Makie.LScene | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||
end | ||||||||
end | ||||||||
return Makie.Axis | ||||||||
end | ||||||||
|
||||||||
function Makie.used_attributes(::Type{<:Plot}, integrator::SciMLBase.DEIntegrator) | ||||||||
(:plot_analytic, :denseplot, :plotdensity, :vars, :idxs) | ||||||||
end | ||||||||
|
@@ -273,6 +299,19 @@ end | |||||||
# Again, we first define the "ideal" plot type for ensemble solutions. | ||||||||
Makie.plottype(sol::SciMLBase.AbstractEnsembleSolution) = Makie.Lines | ||||||||
|
||||||||
# Define preferred axis type for ensemble plots | ||||||||
function Makie.preferred_axis_type(plot::Plot{<:Tuple{<:SciMLBase.AbstractEnsembleSolution}}) | ||||||||
if haskey(plot, :idxs) || haskey(plot, :vars) | ||||||||
idxs = haskey(plot, :idxs) ? plot[:idxs][] : (haskey(plot, :vars) ? plot[:vars][] : nothing) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||
if idxs isa Tuple && length(idxs) == 3 | ||||||||
return Makie.LScene | ||||||||
elseif idxs isa AbstractArray && length(idxs) == 3 | ||||||||
return Makie.LScene | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||
end | ||||||||
end | ||||||||
return Makie.Axis | ||||||||
end | ||||||||
|
||||||||
# We also define the attributes that are used by the ensemble solution recipe: | ||||||||
function Makie.used_attributes(::Type{<:Plot}, sol::SciMLBase.AbstractEnsembleSolution) | ||||||||
(:trajectories, | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dispatch doesn't actually do anything. I don't think you can actually hook into this in this way in Makie v0.24. It might need a small patch, I'm PRing that to Makie now