-
-
Notifications
You must be signed in to change notification settings - Fork 257
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
PR: Implement small plotting API improvements. #1209
Conversation
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.
LGTM besides the imports reorder! See my comment above.
colour/plotting/common.py
Outdated
axes = cast(Axes, axes) | ||
figure = axes.figure | ||
|
||
while isinstance(figure, SubFigure): |
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.
Why are we using while
here?
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.
When I first read the docs I thought the get figure might sometimes return a parent subfigure
colour/plotting/common.py
Outdated
import functools | ||
import itertools | ||
from dataclasses import dataclass, field | ||
from functools import partial | ||
|
||
import matplotlib.cm | ||
import matplotlib.pyplot as plt | ||
import matplotlib.ticker | ||
import numpy as np | ||
from cycler import cycler | ||
from dataclasses import dataclass, field | ||
from functools import partial | ||
from matplotlib.axes import Axes | ||
from matplotlib.colors import LinearSegmentedColormap | ||
from matplotlib.figure import Figure | ||
from matplotlib.patches import Patch | ||
from mpl_toolkits.mplot3d.axes3d import Axes3D |
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.
Let's try to not reorder the imports automatically, it looks like isort
work here and it is not doing a great job. We follow PEP8: https://peps.python.org/pep-0008/#imports
Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants.
Imports should be grouped in the following order:Standard library imports.
Related third party imports.
Local application/library specific imports.
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.
Yeah, it became clear to me that this was a way bigger tool / dev change than I was thinking originally. Removed in this PR.
But I want to revisit this in the future. It's reading - pleasing when my auto-completed imports get put in the correct place by a tool. Ruff has some capability to do this (but I'm not sure about configurability) and isort can probably be made to match pep8.
@@ -701,7 +711,7 @@ def render( | |||
figure.savefig(settings.filename) | |||
|
|||
if settings.show: | |||
plt.show() | |||
plt.show(block=settings.block) |
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.
Nice!
f6e9852
to
09d5863
Compare
Addressed all comments @KelSolaar |
PR is still draft @tjdcs, not sure if it is intended! |
|
No description provided.