ScenTrees.jl
ScenTrees.jl copied to clipboard
Use plot recipe instead of pyplot
Pyplot is a pretty heavy dependency.
An alternative is to write a plotting recipe: https://github.com/JuliaPlots/RecipesBase.jl
This lets you have a very light dependency, and users can use whichever Plots.jl backed they like to plot.
Here's an example in SDDP.jl: https://github.com/odow/SDDP.jl/blob/master/src/visualization/publication_plot.jl
Thank you for this. I will see how possible to rewrite the plotting functions with this
Furthermore, when getting ScenTrees.jl, PyPlot yields an error asking to install a system matplotlib:
[ Info: Precompiling ScenTrees [4ec4db44-c288-11e9-3202-272e944f779a]
ERROR: LoadError: LoadError: InitError: PyError (PyImport_ImportModule
The Python package matplotlib could not be found by pyimport. Usually this means
that you did not install matplotlib in the Python version being used by PyCall.
PyCall is currently configured to use the Python version at:
/usr/bin/python3
and you should use whatever mechanism you usually use (apt-get, pip, conda,
etcetera) to install the Python package containing the matplotlib module.
One alternative is to re-configure PyCall to use a different Python
version on your system: set ENV["PYTHON"] to the path/name of the python
executable you want to use, run Pkg.build("PyCall"), and re-launch Julia.
Another alternative is to configure PyCall to use a Julia-specific Python
distribution via the Conda.jl package (which installs a private Anaconda
Python distribution), which has the advantage that packages can be installed
and kept up-to-date via Julia. As explained in the PyCall documentation,
set ENV["PYTHON"]="", run Pkg.build("PyCall"), and re-launch Julia. Then,
To install the matplotlib module, you can use `pyimport_conda("matplotlib", PKG)`,
where PKG is the Anaconda package the contains the module matplotlib,
or alternatively you can use the Conda package directly (via
`using Conda` followed by `Conda.add` etcetera).
) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'matplotlib'",)
Hello @matbesancon , Have you installed PyPlot.jl?
Not globally, it shouldn't be necessary when you install ScenTrees.jl, because the Project.toml automatically tells you what is needed
I did build well PyPlot and checked that everything was okay. I don't know what is the cause of this but I will redo it again
Yea, PyPlot is not the Julian way. Consider switching to Plots.jl or Makie.jl in the future as these are not attached to specific backends that only run in the presence of another programming language.
I am working towards changing that. I had chose PyPlot because it has functionalities that are required for annotating density plots for both scenario trees and scenario lattices. But i will work towards changing to Plots.jl and also considering the RecipeBase.jl already mentioned.
I do not consider this blocking for the JOSS review https://github.com/openjournals/joss-reviews/issues/1912, can you simply add a mention that matplotlib
is required for now?
@matbesancon Okay I will mention that in the docs for the moment.