Skip to content

Commit

Permalink
add test for tight figure
Browse files Browse the repository at this point in the history
  • Loading branch information
bendichter committed Mar 5, 2024
1 parent aa1ce4c commit 9eefb0e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,32 @@ def test_set_spine_prop():
return fig


@pytest.mark.mpl_image_compare
def test_fig_tight_layout():
fig = plt.figure()

subplot_specs = GridSpec(2, 2)

baxs = []

xlims = ((.1, .3),(.7, .8))
x = np.linspace(0, 1, 100)

for color, sps in zip(['red', 'green', 'blue', 'magenta'], subplot_specs):

bax = brokenaxes(xlims=xlims, subplot_spec=sps)
bax.plot(x, np.sin(x*30), color=color)
baxs.append(bax)

plt.tight_layout()
for bax in baxs:
for handle in bax.diag_handles:
handle.remove()
bax.draw_diags()

return fig


def test_get_axis_special():
fig = plt.figure(figsize=(5, 2))
bax = brokenaxes(
Expand Down
Binary file added test_baseline/test_fig_tight_layout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9eefb0e

Please sign in to comment.