henry2004y / TestParticle.jl

Test particle tracing in electromagnetic field
https://henry2004y.github.io/TestParticle.jl/dev/
MIT License
15 stars 3 forks source link

Makie recipe conflict #142

Closed henry2004y closed 7 months ago

henry2004y commented 7 months ago

Recently, SciMLBase@v2.23.2 has added its own Makie recipe: https://github.com/SciML/SciMLBase.jl/blob/master/ext/SciMLBaseMakieExt.jl. https://github.com/SciML/SciMLBase.jl/issues/427 https://github.com/SciML/SciMLBase.jl/pull/611

This conflicts with our recipe for AbstractODESolution.

I think making a TestParticle.jl recipe for AbstractODESolution is not a long term solution, because at some point when other packages define their recipe for Makie, it will inevitably cause conflicts.

The nice thing about their recipe is that it works for more general types including EnsembleProblems. It maybe contains some better handling of output plotting frequency via :denseplot and plotdensity. However, it does not support current extension features such as passing a function to vars (which will be deprecated) or idxs listed in https://henry2004y.github.io/TestParticle.jl/v0.8/plotfunctions/#Basic-usage

Also related to #47


Actually I noticed that the standard plotting function uses a slightly different way of plotting functions:

f(x, y, z) = (sqrt(x^2 + y^2 + z^2), x)
plot(sol, idxs = (f, 1, 2, 3))
f(t, x, y, z) = (t, sqrt(x^2 + y^2 + z^2))
plot(sol, idxs = (f, 0, 1, 2, 3))

So the technique is to use tuples for organizing plots.


Makie v0.20 introduces a new concept SpecAPI for plotting. I managed to make our own type TraceSolution to be a subtype of AbstractODESolution from DiffEqBase, such that we can reuse the new recipe. The new API does support some new features like plotting an EnsembleSolution, which is very nice! However, this new API that the recipe use is not stable and currently misses many features: https://github.com/MakieOrg/Makie.jl/issues/3623

We need to at least have a temporary workaround for this.