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

Remove hard dependency on ipywidgets and make SVG figures #9

Merged
merged 12 commits into from
Sep 13, 2022

Conversation

nvaytet
Copy link
Member

@nvaytet nvaytet commented Sep 8, 2022

  • Remove hard dependency on ipywidgets
  • make SVG static figures using _repr_mimebundle_
  • Separate toolbar from figure better
  • Add functions on toolbar and figure, such as you can call home or logx on the toolbar or the figure and they will update each other

@nvaytet nvaytet marked this pull request as draft September 8, 2022 21:25
src/plopp/io.py Outdated
from io import BytesIO


def fig_to_pngbytes(fig, form='png'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def fig_to_pngbytes(fig, form='png'):
def fig_to_bytes(fig, form='png'):

?

src/plopp/io.py Outdated

def fig_to_pngbytes(fig, form='png'):
"""
Convert a Matplotlib figure to png bytes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs update?

"""
return {
'text/plain': 'Figure',
'image/svg+xml': fig_to_pngbytes(self._fig, form='svg').decode()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the size of 2d figures manageable? I expect an svg is much larger than png in that case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it is, but now we rasterize the pcolormesh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meaning... the mesh is not vector, but all the rest is?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's how I understand it, but maybe you can check on your display? since the difference between svg and png is not that huge on my monitor

@nvaytet nvaytet marked this pull request as ready for review September 9, 2022 06:32
@nvaytet nvaytet merged commit 813449c into main Sep 13, 2022
@nvaytet nvaytet deleted the use_repr_mimebundle branch September 13, 2022 11:54
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

Successfully merging this pull request may close these issues.

2 participants