Skip to content

Commit b3fbf97

Browse files
committed
formatting
1 parent 0a1e115 commit b3fbf97

2 files changed

Lines changed: 27 additions & 11 deletions

File tree

src/maxplotlib/tests/test_canvas.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ def test_canvas_plot_tikzfigure_vertical_not_supported():
7979

8080
def test_canvas_matplotlib_gridspec_kw_affects_row_spacing():
8181
"""Test that hspace changes the vertical spacing between rows."""
82-
import numpy as np
8382
import matplotlib.pyplot as plt
83+
import numpy as np
8484

8585
from maxplotlib import Canvas
8686

@@ -123,8 +123,8 @@ def test_canvas_matplotlib_gridspec_kw_affects_row_spacing():
123123

124124
def test_canvas_matplotlib_gridspec_kw_affects_2x2_line_spacing():
125125
"""Test that wspace/hspace change spacing for 2×2 line subplot grids."""
126-
import numpy as np
127126
import matplotlib.pyplot as plt
127+
import numpy as np
128128

129129
from maxplotlib import Canvas
130130

@@ -184,8 +184,8 @@ def test_canvas_matplotlib_gridspec_kw_affects_2x2_line_spacing():
184184

185185
def test_canvas_matplotlib_gridspec_kw_affects_2x2_imshow_spacing():
186186
"""Test spacing control also works for 2×2 color (imshow) subplot grids."""
187-
import numpy as np
188187
import matplotlib.pyplot as plt
188+
import numpy as np
189189

190190
from maxplotlib import Canvas
191191

src/maxplotlib/tests/test_plot.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ def test_python_example_nxm_line_subplots_spacing_changes():
2020
for j, ax in enumerate(row):
2121
ax.plot(x, np.sin((i + 1) * (j + 1) * x))
2222
tight_fig, tight_m_axes = tight_canvas.plot(backend="matplotlib")
23-
tight_hgap = tight_m_axes[0, 1].get_position().x0 - tight_m_axes[0, 0].get_position().x1
24-
tight_vgap = tight_m_axes[0, 0].get_position().y0 - tight_m_axes[1, 0].get_position().y1
23+
tight_hgap = (
24+
tight_m_axes[0, 1].get_position().x0 - tight_m_axes[0, 0].get_position().x1
25+
)
26+
tight_vgap = (
27+
tight_m_axes[0, 0].get_position().y0 - tight_m_axes[1, 0].get_position().y1
28+
)
2529

2630
loose_canvas, loose_axes = Canvas.subplots(
2731
nrows=2,
@@ -35,8 +39,12 @@ def test_python_example_nxm_line_subplots_spacing_changes():
3539
for j, ax in enumerate(row):
3640
ax.plot(x, np.sin((i + 1) * (j + 1) * x))
3741
loose_fig, loose_m_axes = loose_canvas.plot(backend="matplotlib")
38-
loose_hgap = loose_m_axes[0, 1].get_position().x0 - loose_m_axes[0, 0].get_position().x1
39-
loose_vgap = loose_m_axes[0, 0].get_position().y0 - loose_m_axes[1, 0].get_position().y1
42+
loose_hgap = (
43+
loose_m_axes[0, 1].get_position().x0 - loose_m_axes[0, 0].get_position().x1
44+
)
45+
loose_vgap = (
46+
loose_m_axes[0, 0].get_position().y0 - loose_m_axes[1, 0].get_position().y1
47+
)
4048

4149
assert loose_hgap > tight_hgap
4250
assert loose_vgap > tight_vgap
@@ -62,8 +70,12 @@ def test_python_example_nxm_color_subplots_spacing_changes():
6270
ax.add_imshow(base + idx, cmap="viridis")
6371
idx += 1
6472
tight_fig, tight_m_axes = tight_canvas.plot(backend="matplotlib")
65-
tight_hgap = tight_m_axes[0, 1].get_position().x0 - tight_m_axes[0, 0].get_position().x1
66-
tight_vgap = tight_m_axes[0, 0].get_position().y0 - tight_m_axes[1, 0].get_position().y1
73+
tight_hgap = (
74+
tight_m_axes[0, 1].get_position().x0 - tight_m_axes[0, 0].get_position().x1
75+
)
76+
tight_vgap = (
77+
tight_m_axes[0, 0].get_position().y0 - tight_m_axes[1, 0].get_position().y1
78+
)
6779

6880
loose_canvas, loose_axes = Canvas.subplots(
6981
nrows=2,
@@ -79,8 +91,12 @@ def test_python_example_nxm_color_subplots_spacing_changes():
7991
ax.add_imshow(base + idx, cmap="viridis")
8092
idx += 1
8193
loose_fig, loose_m_axes = loose_canvas.plot(backend="matplotlib")
82-
loose_hgap = loose_m_axes[0, 1].get_position().x0 - loose_m_axes[0, 0].get_position().x1
83-
loose_vgap = loose_m_axes[0, 0].get_position().y0 - loose_m_axes[1, 0].get_position().y1
94+
loose_hgap = (
95+
loose_m_axes[0, 1].get_position().x0 - loose_m_axes[0, 0].get_position().x1
96+
)
97+
loose_vgap = (
98+
loose_m_axes[0, 0].get_position().y0 - loose_m_axes[1, 0].get_position().y1
99+
)
84100

85101
assert loose_hgap > tight_hgap
86102
assert loose_vgap > tight_vgap

0 commit comments

Comments
 (0)