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

plot_system_graphviz should use ipython display with svg instead of matplotlib png in jupyter #16313

Closed
RussTedrake opened this issue Jan 6, 2022 · 2 comments · Fixed by #22526
Assignees
Labels
component: jupyter Topics relevant only when running inside a Python notebook priority: backlog type: feature request

Comments

@RussTedrake
Copy link
Contributor

I've made this change in my course notes... it outputs and renders an svg instead of a grainy downsampled bitmap in matplotlib.
The diagram in dynamical_systems_tutorial is currently embarrasingly bad.

It would require adding pydot as a python requirement.
this may become obsolete if we fix #13874

@RussTedrake RussTedrake added unused team: dynamics component: jupyter Topics relevant only when running inside a Python notebook labels Jan 6, 2022
@RussTedrake RussTedrake self-assigned this Jan 6, 2022
@jwnimmer-tri
Copy link
Collaborator

The diagram in dynamical_systems_tutorial is currently embarrasingly bad.

At least as of today, the figures in our tutorials look fine to me.

It's not clear to me exactly what the problem or call to action is here. The plot_system_graphviz has used pydot since 2017.

Or did you mean the call to plt.imshow? Maybe that used to do poorly, but it looks fine today.

Maybe we should close this?

@RussTedrake
Copy link
Contributor Author

RussTedrake commented Mar 17, 2024

I agree that original issue description is stale. The dynamical_systems tutorial was changed to use pydot in 97b1531
and looks great.

However, if you replace the lines in dynamical_systems.ipynb on deepnote

display(SVG(pydot.graph_from_dot_data(
    diagram.GetGraphvizString(max_depth=2))[0].create_svg()))

with

from pydrake.all import plot_system_graphviz
plot_system_graphviz(diagram)

the the output is much worse. (it is rasterized, and i don't believe it supports scrolling the same way, etc).

I think the issue should stay open, and yes the call to action is to have plot_system_graphviz use IPython.display instead of plt.imshow.

And presumably the multiple tutorials which call the display(SVG( version should be able to once again use plot_system_graphviz.

@RussTedrake RussTedrake changed the title plot_system_graphviz should use pydot instead of matplotlib (at least in jupyter) plot_system_graphviz should use ipython display with svg instead of matplotlib png in jupyter Jan 25, 2025
RussTedrake added a commit to RussTedrake/drake that referenced this issue Jan 25, 2025
RussTedrake added a commit to RussTedrake/drake that referenced this issue Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: jupyter Topics relevant only when running inside a Python notebook priority: backlog type: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants