Skip to content

Commit 5a336ab

Browse files
committed
Fix title cutting off, move comment back
1 parent d8d7a93 commit 5a336ab

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

sectionproperties/post/post.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88

99
@contextlib.contextmanager
10-
def plotting_context(ax=None, pause=True, title="", filename="", render=True, axis_index=None, **kwargs):
10+
def plotting_context(
11+
ax=None, pause=True, title="", filename="", render=True, axis_index=None, **kwargs
12+
):
1113
"""Executes code required to set up a matplotlib figure.
1214
1315
:param ax: Axes object on which to plot
@@ -47,7 +49,9 @@ def plotting_context(ax=None, pause=True, title="", filename="", render=True, ax
4749
except (AttributeError, TypeError):
4850
pass # only 1 axis, not an array
4951
except IndexError as exc:
50-
raise ValueError(f"axis_index={axis_index} is not compatible with arguments to subplots: {kwargs}") from exc
52+
raise ValueError(
53+
f"axis_index={axis_index} is not compatible with arguments to subplots: {kwargs}"
54+
) from exc
5155
else:
5256
fig = ax.get_figure()
5357
ax_supplied = True
@@ -56,12 +60,11 @@ def plotting_context(ax=None, pause=True, title="", filename="", render=True, ax
5660

5761
yield fig, ax
5862

59-
# if no axes was supplied, finish the plot and return the figure and axes
63+
ax.set_title(title)
6064
plt.tight_layout()
61-
6265
ax.set_aspect("equal", anchor="C")
63-
ax.set_title(title)
6466

67+
# if no axes was supplied, finish the plot and return the figure and axes
6568
if ax_supplied:
6669
# if an axis was supplied, don't continue with displaying or configuring the plot
6770
return

0 commit comments

Comments
 (0)