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

Replace PyPlot calls with Plots.jl #66

Open
hdrake opened this issue Jan 17, 2021 · 5 comments
Open

Replace PyPlot calls with Plots.jl #66

hdrake opened this issue Jan 17, 2021 · 5 comments
Labels
meta question Further information is requested

Comments

@hdrake
Copy link
Collaborator

hdrake commented Jan 17, 2021

@fonsp has mentioned that having PyPlot as a dependency for ClimateMARGO.jl unecessarily complicates things.

I see three options for moving forward:

  1. Re-implement plotting functions using Plots.jl
  2. Remove plotting submodule from ClimateMARGO.jl and include it in separate PlotMARGO.jl package, or more general utility package
  3. Same as (2) but re-implement using Plots.jl

What do you think @fonsp? My understanding is that you already have a hacky way of removing the plotting package dependencies– is this even necessary? I think it might be desirable even for your average user because it will decrease build / binder spin-up time?

@hdrake hdrake added question Further information is requested meta labels Jan 17, 2021
@fonsp
Copy link
Member

fonsp commented Jan 19, 2021

I think rewriting to Plots.jl is a good idea, partly because right now the following does not work:

  • Get a new computer
  • Install Julia
  • pkg> add ClimateMARGO
  • julia> using ClimateMARGO

This is because the last command will initialize PyPlot.jl, which searches for an existing installation of matplotlib, and if not found, it prints an error with instructions.


About 1.2.3.: If you use Plots.jl (1.), then you can write the plot functions without adding Plots.jl as a dependency to ClimateMARGO, so (2.) and (3.) are no longer necessary.

There is a package specifically for this situation: https://github.com/JuliaPlots/RecipesBase.jl . It is a "mock version" of Plots.jl that allows packages to define their own plots using plot commands, but they only work if the user installs Plots themselves. But if a user does not want MARGO's plotting functions, then there is very little overhead.

@hdrake
Copy link
Collaborator Author

hdrake commented Jan 19, 2021

It is a "mock version" of Plots.jl that allows packages to define their own plots using plot commands, but they only work if the user installs Plots themselves.

Will this be transparent enough for users? Like it will give instructions when you try to plot? I don’t want people to expect plots and not know why they don’t show up.

@fonsp
Copy link
Member

fonsp commented Jan 20, 2021

That's a good point -- currently it does not, but I have submitted this to JuliaPlots/Plots.jl#4431

If they can't fix it soon, we can write our own workaround to print this warning.

@fonsp
Copy link
Member

fonsp commented Jan 20, 2021

We can also just make Plots.jl one of our dependencies (without the Recipes trick). Maybe we are over-optimizing by not including it, even though users of ClimateMARGO will very likely want to plot the results.

@hdrake hdrake changed the title Plotting MARGO results and other utilities Replace PyPlot calls with Plots.jl Dec 28, 2021
@hdrake
Copy link
Collaborator Author

hdrake commented Feb 5, 2022

Addressing this issue in #84

@hdrake hdrake added this to the v1.0.0 release milestone Feb 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants