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

Easier figure support (Plots and Makie) #16

Open
matthijscox-asml opened this issue Feb 1, 2023 · 7 comments
Open

Easier figure support (Plots and Makie) #16

matthijscox-asml opened this issue Feb 1, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@matthijscox-asml
Copy link
Collaborator

matthijscox-asml commented Feb 1, 2023

We're still thinking about easier figure support.

Right now you'd have to

  • load your favorite plotting package, let's assume either Plots.jl or Makie.jl.
  • Then make a plot
  • Find and use the savefig() function of your favorite plotting package.
  • Wrap the saved figure path into a Picture() type and add it to a Slide.

Ideally this is simplified into:

fig = plot(1:5,1:5)
pic = Picture(fig)

Or even just push the figure into a Slide directly.

Most difficult technical challenge is that we ideally want to avoid including Plots and Makie as a dependency. These are rather large dependencies that we do not want to force onto the user, as some will not want to include figures into their generated slide decks.

@matthijscox-asml matthijscox-asml added the enhancement New feature or request label Feb 1, 2023
@asinghvi17
Copy link

I believe that Plots.jl defines the Plot type in RecipesBase.jl, which is a very lightweight package. Makie does not define its top-level type in MakieCore, its equivalent of RecipesBase, so I'm not 100% sure what you could do there, but will have a look.

Another consideration is that the dimensions of the plot could be determined by PPTX.jl, the user, or some combination of both. One would also want higher resolution figures so that they look good in a presentation or on a projector. Some sort of feedback mechanism might be required.

@matthijscox-asml
Copy link
Collaborator Author

Cool, thanks for the suggestions!

Is the savefig function also defined inside RecipesBase.jl? I don't think so. And what would be a good way to include the savefig functionality then?

@asinghvi17
Copy link

I suspect not. Neither is Makie's saving functionality (using FileIO) defined in MakieCore.

You could use https://github.com/JuliaPackaging/Requires.jl to add some code which will load only when the respective library (Plots/Makie) is loaded, which overrides the Picture method with Plots.Plot or Makie.FigureLike.

Out of curiosity, what's your end goal for this package?

@matthijscox-asml
Copy link
Collaborator Author

Thanks, I'll look into Requires.jl. I'd prefer to not use such trickery, but it might be the only way.

The end goal of the package is to make fancy PowerPoints easily with a few Julia commands. In the corporate world, at least at my employer, PowerPoints are often used as a kind of static portable dashboards, automatically generated by analysis scripts. People have been complaining they cannot do this from Julia.

Personally, I think if we can make tables, plots and text boxes we have a good foundation. And layout those easily on slides, maybe with a relative grid layout (I like the Makie grid layout approach). If you have ideas for other functionality, feel free to open an issue.

@asinghvi17
Copy link

Aha! I thought it was something like that. Yes, Makie has some good stuff - grid layouts are made using https://github.com/jkrumbiegel/GridLayoutBase.jl which is not too well documented but shouldn't be too hard to dive into, and basically uses the same layout syntax as Makie does. You'd just have to hook up the PowerPoint object types you currently have into the layout using something like this:

https://github.com/MakieOrg/Makie.jl/blob/156e651ffd1b20eed3f511f925c1e8ac4eed1474/src/makielayout/blocks.jl#L295-L433

Another interesting approach is https://github.com/fatteneder/MakieSlides.jl which is basically rendering presentations in Makie - either as PDFs or display them using Makie's interactive backends. This allows you to also add animations, interactive features, etc as desired which can interact with your actual data on demand.

@BeastyBlacksmith
Copy link

I think it would be the easiest to do this via package extensions, since the user has to load the plotting library anyways

@matthijscox-asml
Copy link
Collaborator Author

I think it would be the easiest to do this via package extensions, since the user has to load the plotting library anyways

True, this would be a good solution, except we will break compatibility with older Julia version. Decisions, decisions...

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

No branches or pull requests

3 participants