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

Plotting example #17

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

Plotting example #17

matthijscox-asml opened this issue Feb 1, 2023 · 2 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@matthijscox-asml
Copy link
Collaborator

I'd like to have a plotting example in the documentation.

I think you have to:

  • Load your favorite plotting package, let's assume either Plots.jl or Makie.jl.
  • Then make a plot, say fig = plot(1:5,1:5)
  • Find and use the savefig(fig, path) function of your favorite plotting package.
  • Wrap the saved figure path into a Picture() type and push it into a Slide.

We can try how annoying it is to position multiple pictures on a slide. We can then define enhancement issues to address that.

Related issue: #16

@matthijscox-asml matthijscox-asml added documentation Improvements or additions to documentation good first issue Good for newcomers labels Feb 1, 2023
@DrChainsaw
Copy link

Thanks alot for this package! I had the misfortune of making my own ppt exporter just a few days before your announcement wrapping a python lib for the pptx integration and I'm looking forward to switching to this package instead.

We can try how annoying it is to position multiple pictures on a slide. We can then define enhancement issues to address that.

A neat trick that at least works with Plots is to freeride on the layout mechanism from that package since the subplots and their positions are (at least to me) surprisingly easy to access through what appears to be public APIs.

Example:

julia> plt = plot(plot(randn(10)), plot(1:10)) #Not gonna bother with any advanced layout here

julia> for pind in 1:length(plt)
       subplt = plt[pind]
       @info "subplot nr $pind at position $(plotarea(subplt))"
       end
[ Info: subplot nr 1 at position BBox{l,t,r,b,w,h = 12.314935833891495mm,3.0mm, 74.9455056932351mm,94.38944mm, 62.63056985934361mm,91.38944mm}
[ Info: subplot nr 2 at position BBox{l,t,r,b,w,h = 86.76943014065641mm,3.0mm, 149.40000000000003mm,94.38944mm, 62.630569859343616mm,91.38944mm}

In addition, this gave a very nice WYSIWYG aspect while still allowing the user to move the plots around independently.

One issue is that the sizes don't materialize unless you actually try to display the plot. One can either show the plot to a dummy IO (e.g. show(IOBuffer(), plt))or use the non-public Plots.prepare_output(plt).

Another feature useful in this context is the grouped shapes in power point. If the plots do not fit on a slide one can just change the size of the entire group and the plots stay aligned.

@matthijscox-asml
Copy link
Collaborator Author

Great! We started with wrapping the python-pptx package, but installing Python is annoying. Pure Julia is better, but we may lack some features.

Please try out the package and feel free to report back with plotting documentation ideas :)

For direct Plots integration itself, I started this issue: #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants