ProbabilityBoundsAnalysis.jl icon indicating copy to clipboard operation
ProbabilityBoundsAnalysis.jl copied to clipboard

Use plot recipes (from RecipesBase)

Open mforets opened this issue 3 years ago • 3 comments

Loading Plots (the library) and this package conflict because of the definitions around here. It may be possible to change the dependency to RecipesBase (instead of PyPlots) and adds plot recipes, which dispatch on the new types defined in the package.

mforets avatar Jun 13 '21 15:06 mforets

The main PyPlot - specific option used seems to be the step function, may be generalized with sth like

pyplot()

j = (0:(s.n-1))/s.n;
Plots.plot([s.u[:];s.u[s.n];s.d[s.n]], [j;1;1], linetype=:steppre)

i = (1:(s.n))/s.n;
Plots.plot!([s.u[1];s.d[1];s.d[:]], [0;0;i], linetype=:steppost)

mforets avatar Jun 24 '21 14:06 mforets

An easy alternative (if you are not interested in supporting other plotting backends in this package) might be to add PyPlot as an optional dependency through Requires.jl, and rename the plotting functions to avoid the name clash with someone using Plots.jl, eg. plot_pbox and plot_cdf. For reference with this approach, see this package.

mforets avatar Jul 18 '21 04:07 mforets

Thanks for this suggestion. I've added a branch using this as a quick fix.

PyPlot and PyCall are no longer in the dependencies.

Also started migrating over to Plots.jl, but having some problems when specifying pyplot as the backend...

AnderGray avatar Jul 30 '21 12:07 AnderGray