-
Notifications
You must be signed in to change notification settings - Fork 926
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
update legend, xlabel & format of matplotlib plots #2346
Conversation
Performance benchmarks:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All obviously good changes!
One question, are there any implications for performance? Is exporting to SVG slower (or faster) than to PNG?
Otherwise, go ahead and merge.
@@ -63,7 +63,9 @@ def SpaceMatplotlib( | |||
elif space is None and propertylayer_portrayal: | |||
draw_property_layers(space_ax, space, propertylayer_portrayal, model) | |||
|
|||
solara.FigureMatplotlib(space_fig, format="png", dependencies=dependencies) | |||
solara.FigureMatplotlib( | |||
space_fig, format="svg", bbox_inches="tight", dependencies=dependencies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using png is intentional: #1806 (comment). At the very least, a comment should be added to say it is for performance reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes svg is indeed very low as compare to png: solara-perf.ipynb (863 ms for png vs. 3.89 s for svg, for a 200x200 schelling model). I also tried increasing png dpi from default 100 to 300, and it becomes slower with no noticeable improvement in terms of plot quality. I have changed back to png format in this PR.
35c13e9
to
37a23b7
Compare
ax.legend(loc="best")
Before:
After: