<h3 dir="auto">Bug summary</h3>
<p dir="auto">The line <code class="notranslate">fig, ax = plt.subplots(nrows=1, ncols=2, figsize=[12,6])</code> results in the following warning message:</p>
<p dir="auto"><code class="notranslate">MatplotlibDeprecationWarning: The resize_event function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use callbacks.process('resize_event', ResizeEvent(...)) instead.</code></p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt
fig, ax = plt.subplots(nrows=1, ncols=2, figsize=[12,6])"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-s1">fig</span>, <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>(<span class="pl-s1">nrows</span><span class="pl-c1">=</span><span class="pl-c1">1</span>, <span class="pl-s1">ncols</span><span class="pl-c1">=</span><span class="pl-c1">2</span>, <span class="pl-s1">figsize</span><span class="pl-c1">=</span>[<span class="pl-c1">12</span>,<span class="pl-c1">6</span>])</pre></div>
<h3 dir="auto">Actual outcome</h3>
<p dir="auto"><code class="notranslate">MatplotlibDeprecationWarning: The resize_event function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use callbacks.process('resize_event', ResizeEvent(...)) instead.</code><br>
<code class="notranslate">fig, ax = plt.subplots(nrows=1, ncols=2, figsize=[12,6])</code></p>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">No warning message.</p>
<h3 dir="auto">Additional information</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">macOS</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.6.0</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">MacOSX</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">3.10.6</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto">6.4.12</p>
<h3 dir="auto">Installation</h3>
<p dir="auto">pip</p>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">Using GTK3Cairo, TkCairo, and Qt5Cairo cause specgram() y-axis data to appear to rotate 180 degrees, while x-axis data is correct.  Compared with, for example, Qt5Agg, TkAgg, and GTK3Agg.</p>
<p dir="auto"><strong>Code for reproduction</strong></p>
<p dir="auto">MWE (from comment <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="343213251" data-permission-text="Title is private" data-url="https://github.com/matplotlib/matplotlib/issues/11715" data-hovercard-type="issue" data-hovercard-url="/matplotlib/matplotlib/issues/11715/hovercard?comment_id=406735726&amp;comment_type=issue_comment" href="https://github.com/matplotlib/matplotlib/issues/11715#issuecomment-406735726">#11715 (comment)</a>):</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="ax1 = plt.subplot(212)
x = np.random.rand(20, 20)
x[3, :] = 19.
ax1.imshow(x)
plt.show()"><pre class="notranslate"><span class="pl-s1">ax1</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplot</span>(<span class="pl-c1">212</span>)
<span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">rand</span>(<span class="pl-c1">20</span>, <span class="pl-c1">20</span>)
<span class="pl-s1">x</span>[<span class="pl-c1">3</span>, :] <span class="pl-c1">=</span> <span class="pl-c1">19.</span>
<span class="pl-s1">ax1</span>.<span class="pl-en">imshow</span>(<span class="pl-s1">x</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto">ORIGINAL MWE:<br>
(code pulled from <a href="https://matplotlib.org/gallery/images_contours_and_fields/specgram_demo.html#sphx-glr-gallery-images-contours-and-fields-specgram-demo-py" rel="nofollow">https://matplotlib.org/gallery/images_contours_and_fields/specgram_demo.html#sphx-glr-gallery-images-contours-and-fields-specgram-demo-py</a> and modified to include matplotlib.use(...) only)</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Paste your code here
#
import matplotlib
#matplotlib.use(&quot;Qt5Cairo&quot;)# BAD - rotation
#matplotlib.use(&quot;TkCairo&quot;)# BAD - rotation
#matplotlib.use(&quot;GTK3Cairo&quot;)# BAD - rotation
matplotlib.use(&quot;Qt5Agg&quot;)# Good
#matplotlib.use(&quot;TkAgg&quot;)# Good
#matplotlib.use(&quot;GTK3Agg&quot;)# Good
#matplotlib.use(&quot;WebAgg&quot;)# Good
#%valid strings are ['GTK', 'GTKAgg', 'GTKCairo', 'GTK3Agg', 'GTK3Cairo', 'MacOSX', 'nbAgg', 'Qt4Agg', 'Qt4Cairo', 'Qt5Agg', 'Qt5Cairo', 'TkAgg', 'TkCairo', 'WebAgg', 'WX', 'WXAgg', 'WXCairo', 'agg', 'cairo', 'gdk', 'pdf', 'pgf', 'ps', 'svg', 'template']

import matplotlib.pyplot as plt
import numpy as np

# Fixing random state for reproducibility
np.random.seed(19680801)


dt = 0.0005
t = np.arange(0.0, 20.0, dt)
s1 = np.sin(2 * np.pi * 100 * t)
s2 = 2 * np.sin(2 * np.pi * 400 * t)

# create a transient &quot;chirp&quot;
mask = np.where(np.logical_and(t &gt; 10, t &lt; 12), 1.0, 0.0)
s2 = s2 * mask

# add some noise into the mix
nse = 0.01 * np.random.random(size=len(t))

x = s1 + s2 + nse  # the signal
NFFT = 1024       # the length of the windowing segments
Fs = int(1.0 / dt)  # the sampling frequency

# Pxx is the segments x freqs array of instantaneous power, freqs is
# the frequency vector, bins are the centers of the time bins in which
# the power is computed, and im is the matplotlib.image.AxesImage
# instance

ax1 = plt.subplot(211)
plt.plot(t, x)
plt.subplot(212, sharex=ax1)
Pxx, freqs, bins, im = plt.specgram(x, NFFT=NFFT, Fs=Fs, noverlap=900)
plt.show()"><pre class="notranslate"><span class="pl-c"># Paste your code here</span>
<span class="pl-c">#</span>
<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>
<span class="pl-c">#matplotlib.use("Qt5Cairo")# BAD - rotation</span>
<span class="pl-c">#matplotlib.use("TkCairo")# BAD - rotation</span>
<span class="pl-c">#matplotlib.use("GTK3Cairo")# BAD - rotation</span>
<span class="pl-s1">matplotlib</span>.<span class="pl-en">use</span>(<span class="pl-s">"Qt5Agg"</span>)<span class="pl-c"># Good</span>
<span class="pl-c">#matplotlib.use("TkAgg")# Good</span>
<span class="pl-c">#matplotlib.use("GTK3Agg")# Good</span>
<span class="pl-c">#matplotlib.use("WebAgg")# Good</span>
<span class="pl-c">#%valid strings are ['GTK', 'GTKAgg', 'GTKCairo', 'GTK3Agg', 'GTK3Cairo', 'MacOSX', 'nbAgg', 'Qt4Agg', 'Qt4Cairo', 'Qt5Agg', 'Qt5Cairo', 'TkAgg', 'TkCairo', 'WebAgg', 'WX', 'WXAgg', 'WXCairo', 'agg', 'cairo', 'gdk', 'pdf', 'pgf', 'ps', 'svg', 'template']</span>

<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-c"># Fixing random state for reproducibility</span>
<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">seed</span>(<span class="pl-c1">19680801</span>)


<span class="pl-s1">dt</span> <span class="pl-c1">=</span> <span class="pl-c1">0.0005</span>
<span class="pl-s1">t</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">0.0</span>, <span class="pl-c1">20.0</span>, <span class="pl-s1">dt</span>)
<span class="pl-s1">s1</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">sin</span>(<span class="pl-c1">2</span> <span class="pl-c1">*</span> <span class="pl-s1">np</span>.<span class="pl-s1">pi</span> <span class="pl-c1">*</span> <span class="pl-c1">100</span> <span class="pl-c1">*</span> <span class="pl-s1">t</span>)
<span class="pl-s1">s2</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span> <span class="pl-c1">*</span> <span class="pl-s1">np</span>.<span class="pl-en">sin</span>(<span class="pl-c1">2</span> <span class="pl-c1">*</span> <span class="pl-s1">np</span>.<span class="pl-s1">pi</span> <span class="pl-c1">*</span> <span class="pl-c1">400</span> <span class="pl-c1">*</span> <span class="pl-s1">t</span>)

<span class="pl-c"># create a transient "chirp"</span>
<span class="pl-s1">mask</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">where</span>(<span class="pl-s1">np</span>.<span class="pl-en">logical_and</span>(<span class="pl-s1">t</span> <span class="pl-c1">&gt;</span> <span class="pl-c1">10</span>, <span class="pl-s1">t</span> <span class="pl-c1">&lt;</span> <span class="pl-c1">12</span>), <span class="pl-c1">1.0</span>, <span class="pl-c1">0.0</span>)
<span class="pl-s1">s2</span> <span class="pl-c1">=</span> <span class="pl-s1">s2</span> <span class="pl-c1">*</span> <span class="pl-s1">mask</span>

<span class="pl-c"># add some noise into the mix</span>
<span class="pl-s1">nse</span> <span class="pl-c1">=</span> <span class="pl-c1">0.01</span> <span class="pl-c1">*</span> <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">random</span>(<span class="pl-s1">size</span><span class="pl-c1">=</span><span class="pl-en">len</span>(<span class="pl-s1">t</span>))

<span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">s1</span> <span class="pl-c1">+</span> <span class="pl-s1">s2</span> <span class="pl-c1">+</span> <span class="pl-s1">nse</span>  <span class="pl-c"># the signal</span>
<span class="pl-v">NFFT</span> <span class="pl-c1">=</span> <span class="pl-c1">1024</span>       <span class="pl-c"># the length of the windowing segments</span>
<span class="pl-v">Fs</span> <span class="pl-c1">=</span> <span class="pl-en">int</span>(<span class="pl-c1">1.0</span> <span class="pl-c1">/</span> <span class="pl-s1">dt</span>)  <span class="pl-c"># the sampling frequency</span>

<span class="pl-c"># Pxx is the segments x freqs array of instantaneous power, freqs is</span>
<span class="pl-c"># the frequency vector, bins are the centers of the time bins in which</span>
<span class="pl-c"># the power is computed, and im is the matplotlib.image.AxesImage</span>
<span class="pl-c"># instance</span>

<span class="pl-s1">ax1</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplot</span>(<span class="pl-c1">211</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>(<span class="pl-s1">t</span>, <span class="pl-s1">x</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">subplot</span>(<span class="pl-c1">212</span>, <span class="pl-s1">sharex</span><span class="pl-c1">=</span><span class="pl-s1">ax1</span>)
<span class="pl-v">Pxx</span>, <span class="pl-s1">freqs</span>, <span class="pl-s1">bins</span>, <span class="pl-s1">im</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">specgram</span>(<span class="pl-s1">x</span>, <span class="pl-v">NFFT</span><span class="pl-c1">=</span><span class="pl-v">NFFT</span>, <span class="pl-v">Fs</span><span class="pl-c1">=</span><span class="pl-v">Fs</span>, <span class="pl-s1">noverlap</span><span class="pl-c1">=</span><span class="pl-c1">900</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/5010253/43019235-e6150a30-8c21-11e8-89c6-2f5732ccb268.png"><img src="https://user-images.githubusercontent.com/5010253/43019235-e6150a30-8c21-11e8-89c6-2f5732ccb268.png" alt="cairo_backend" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/5010253/43019207-cdf5315a-8c21-11e8-9eb4-9218990fbc26.png"><img src="https://user-images.githubusercontent.com/5010253/43019207-cdf5315a-8c21-11e8-9eb4-9218990fbc26.png" alt="agg_backend" style="max-width: 100%;"></a></p>
<p dir="auto">Unsure whether this issue occurred in previous versions...</p>
<p dir="auto"><strong>Matplotlib version</strong></p>
<ul dir="auto">
<li>Operating system: Windows 10 and Mingw64</li>
<li>Matplotlib version: 2.2.2<br>
<em>WORKING</em></li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): Qt5Agg, TkAgg, GTK3Agg, WebAgg, etc.<br>
<em>NOT WORKING</em></li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): Qt5Cairo, TkCairo, GTK3Cairo, cairo</li>
<li>Python version: 3.6.5 (Anaconda3), 3.7.0 (Mingw64)</li>
<li>Other libraries: numpy</li>
</ul>


<p dir="auto">For <code class="notranslate">conda</code> (Anaconda3), matplotlib installed from default channels<br>
For <code class="notranslate">mingw</code> (MSYS2), matplotlib installed using <code class="notranslate">pacman -S mingw-w64-x86_64-python3-matplotlib</code> (2.2.2-2 mingw64)</p>
<p dir="auto">For GTK-based backends, GTK and GObject, including all dependencies were installed following Windows directions from: <a href="https://pygobject.readthedocs.io/en/latest/getting_started.html" rel="nofollow">https://pygobject.readthedocs.io/en/latest/getting_started.html</a>  However, I used <code class="notranslate">x86_64</code> versions instead of <code class="notranslate">i686</code> versions.</p>
<p dir="auto"><strong>Note</strong><br>
It is unclear to me whether this is a Matplotlib bug, or due to Cairo.  I do not have any other Cairo-based issues except for Matplotlib's <code class="notranslate">specgram()</code>.</p>