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

Skip to content

Commit 3ee2131

Browse files
theodorjukate-perkins
authored andcommitted
Adding test for issue 17878
1 parent b5ef28f commit 3ee2131

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4099,6 +4099,22 @@ def test_specgram_fs_none():
40994099
assert xmin == 32 and xmax == 96
41004100

41014101

4102+
@check_figures_equal(extensions=["png"])
4103+
def test_specgram_origin(fig_test, fig_ref):
4104+
"""Test that specgram ignores origin='lower' and always uses origin='upper'."""
4105+
t = np.arange(0.0, 500)
4106+
signal = np.sin(2 * np.pi * 100 * t)
4107+
4108+
# Reference: First graph using default origin in imshow (upper),
4109+
fig_ref.subplots().specgram(signal)
4110+
4111+
# Try to overwrite the setting trying to flip the specgram
4112+
plt.rcParams["image.origin"] = 'lower'
4113+
4114+
# Test: origin='lower' should be ignored
4115+
fig_test.subplots().specgram(signal)
4116+
4117+
41024118
@image_comparison(
41034119
["psd_freqs.png", "csd_freqs.png", "psd_noise.png", "csd_noise.png"],
41044120
remove_text=True, tol=0.002)

0 commit comments

Comments
 (0)