Issue 1:
Bug summary

The line fig, ax = plt.subplots(nrows=1, ncols=2, figsize=[12,6]) results in the following warning message:

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 for reproduction

import matplotlib.pyplot as plt
fig, ax = plt.subplots(nrows=1, ncols=2, figsize=[12,6])

Actual outcome

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.

fig, ax = plt.subplots(nrows=1, ncols=2, figsize=[12,6])

Expected outcome

No warning message.

Additional information

No response

Operating system

macOS

Matplotlib Version

3.6.0

Matplotlib Backend

MacOSX

Python version

3.10.6

Jupyter version

6.4.12

Installation

pip

Issue 2:
Bug report

Bug summary

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.

Code for reproduction

MWE (from comment #11715 (comment)):

ax1 = plt.subplot(212)
x = np.random.rand(20, 20)
x[3, :] = 19.
ax1.imshow(x)
plt.show()

ORIGINAL MWE:

(code pulled from https://matplotlib.org/gallery/images_contours_and_fields/specgram_demo.html#sphx-glr-gallery-images-contours-and-fields-specgram-demo-py and modified to include matplotlib.use(...) only)

# Paste your code here
#
import matplotlib
#matplotlib.use("Qt5Cairo")# BAD - rotation
#matplotlib.use("TkCairo")# BAD - rotation
#matplotlib.use("GTK3Cairo")# BAD - rotation
matplotlib.use("Qt5Agg")# Good
#matplotlib.use("TkAgg")# Good
#matplotlib.use("GTK3Agg")# Good
#matplotlib.use("WebAgg")# 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 "chirp"
mask = np.where(np.logical_and(t > 10, t < 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()

Actual outcome

Expected outcome

Unsure whether this issue occurred in previous versions...

Matplotlib version

Operating system: Windows 10 and Mingw64

Matplotlib version: 2.2.2

WORKING

Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg, TkAgg, GTK3Agg, WebAgg, etc.

NOT WORKING

Matplotlib backend (print(matplotlib.get_backend())): Qt5Cairo, TkCairo, GTK3Cairo, cairo

Python version: 3.6.5 (Anaconda3), 3.7.0 (Mingw64)

Other libraries: numpy

For conda (Anaconda3), matplotlib installed from default channels

For mingw (MSYS2), matplotlib installed using pacman -S mingw-w64-x86_64-python3-matplotlib (2.2.2-2 mingw64)

For GTK-based backends, GTK and GObject, including all dependencies were installed following Windows directions from: https://pygobject.readthedocs.io/en/latest/getting_started.html However, I used x86_64 versions instead of i686 versions.

Note

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 specgram().