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

Possible missing import or Plots.jl dependency #165

Closed
lmondada opened this issue Aug 15, 2021 · 4 comments
Closed

Possible missing import or Plots.jl dependency #165

lmondada opened this issue Aug 15, 2021 · 4 comments

Comments

@lmondada
Copy link

Hi everyone,

Issue description

If I ] add GraphRecipes in a new environment, and then run a simple example

using GraphRecipes
g = [0 1 1; 1 0 1; 1 1 0]
graphplot(g)

I get the following error

ERROR: MethodError: no method matching plot(::GraphRecipes.GraphPlot)

Possible fix

] add Plots and using Plots fixes this. So fixing this should be as simple as adding a dependency, or maybe there is a missing import somewhere. Or maybe I am just using the package wrong. Let me know what you think the simplest fix would be. Happy to submit a PR if that helps.

Cheers!
Luca

@BeastyBlacksmith
Copy link
Member

Seems this should be documented more clearly. So GraphRecipes is a collection of Plots.jl recipes.
Thats why it should only used in conjunction with Plots.jl.

@lmondada
Copy link
Author

Ok, that makes sense. I agree that writing that explicitly in the docs would solve this. But can I ask: what's the rationale for not having Plots.jl as a dependency?

@JackDevine
Copy link
Member

Ok, that makes sense. I agree that writing that explicitly in the docs would solve this.

The readme has using Plots in it. Of course, if you see any examples in the docs where using Plots is not obvious, then feel free to update those docs.

what's the rationale for not having Plots.jl as a dependency?

The idea of plot recipes is to provide plotting as an optional dependancy. For example, in DifferentialEquations.jl you can pass the solution of a differential equation to plot and it will give you a nice plot of the solution. Most users of DifferentialEquations.jl wont actually use this feature, so they shouldn't have to download Plots.jl. For the users that do want to use the DifferentialEquations.jl plot recipe, all they have to do is using Plots and they are good to go. Both types of user just have to download (the rather light weight) PlotsRecipes code.

Another reason that plot recipes don't explicitly depend on Plots.jl is that they are designed to be consumed by different "engines". In principle, it could be possible for different plotting engines to render the recipes defined in PlotRecipes.jl. All that they would have to do is overload some methods of plot as defined in PlotRecipes. I think that there was some talk of Makie being able to work with plot recipes, therefore linking the Plots.jl and Makie.jl ecosystems. From what I can see, Makie has moved in a different direction to Plots.jl and the two ecosystems are separate for now. Having said that, things move quite fast and I could be out of date.

@BeastyBlacksmith
Copy link
Member

What could help here is JuliaPlots/Plots.jl#4431, otherwise I'd say this is expected behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants