Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit deb03d8

Browse files
authored
Merge pull request #24668 from oscargus/axisoptionstest
Add test for remaining axis options
2 parents d8bb1a5 + 40751cb commit deb03d8

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7280,6 +7280,24 @@ def test_secondary_repr():
72807280
assert repr(secax) == '<SecondaryAxis: >'
72817281

72827282

7283+
@image_comparison(['axis_options.png'], remove_text=True, style='mpl20')
7284+
def test_axis_options():
7285+
fig, axes = plt.subplots(2, 3)
7286+
for i, option in enumerate(('scaled', 'tight', 'image')):
7287+
# Draw a line and a circle fitting within the boundaries of the line
7288+
# The circle should look like a circle for 'scaled' and 'image'
7289+
# High/narrow aspect ratio
7290+
axes[0, i].plot((1, 2), (1, 3.2))
7291+
axes[0, i].axis(option)
7292+
axes[0, i].add_artist(mpatches.Circle((1.5, 1.5), radius=0.5,
7293+
facecolor='none', edgecolor='k'))
7294+
# Low/wide aspect ratio
7295+
axes[1, i].plot((1, 2.25), (1, 1.75))
7296+
axes[1, i].axis(option)
7297+
axes[1, i].add_artist(mpatches.Circle((1.5, 1.25), radius=0.25,
7298+
facecolor='none', edgecolor='k'))
7299+
7300+
72837301
def color_boxes(fig, ax):
72847302
"""
72857303
Helper for the tests below that test the extents of various axes elements

0 commit comments

Comments
 (0)