Issue 1:
Bug summary

The color bar is not properly displayed after version 3.5.0

Code for reproduction

Compare:
https://matplotlib.org/stable/tutorials/colors/colormapnorms.html#twoslopenorm-different-mapping-on-either-side-of-a-center
OR
https://matplotlib.org/devdocs/tutorials/colors/colormapnorms.html#twoslopenorm-different-mapping-on-either-side-of-a-center
with the older version:
https://matplotlib.org/3.4.3/tutorials/colors/colormapnorms.html#twoslopenorm-different-mapping-on-either-side-of-a-center

Actual outcome

new.pdf

the color bar between -500 to 0 is as long as from 0 to 4000, although should be as long as 0 to 500

Expected outcome

Additional information

No response

Operating system

No response

Matplotlib Version

stable/dev

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

No response

Issue 2:
Bug summary

When using TwoSlopeNorm with pcolormesh, I receive errors when I try to set the colorbar limits to both be on one side of the vcenter specified in TwoSlopeNorm.

Code for reproduction

import matplotlib.pyplot as plt
import matplotlib.colors as mcolors

x = [[0, 1, 2], [0, 1, 2], [0, 1, 2]]
y = [[0, 0, 0], [1, 1, 1], [2, 2, 2]]
data = [[-1, -2], [-2, -3]]

plt.pcolormesh(x, y, data, cmap="coolwarm", norm=mcolors.TwoSlopeNorm(vmin=-3, vcenter=0, vmax=1))
plt.colorbar()

plt.clim([-3, -1]) # this breaks
# plt.clim([-3, 1]) # this works fine
# plt.clim([1, 3]) # this also breaks

Actual outcome

Traceback (most recent call last):
File "/home/eytan/Documents/matplotlib_debug.py", line 11, in <module>
plt.clim([-3, -1]) # this breaks
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/pyplot.py", line 2131, in clim
im.set_clim(vmin, vmax)
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/cm.py", line 525, in set_clim
self.norm.vmax = colors._sanitize_extrema(vmax)
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/colors.py", line 1161, in vmax
self._changed()
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/colors.py", line 1178, in _changed
self.callbacks.process('changed')
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/cbook/__init__.py", line 292, in process
self.exception_handler(exc)
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/cbook/__init__.py", line 96, in _exception_printer
raise exc
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/cbook/__init__.py", line 287, in process
func(*args, **kwargs)
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/cm.py", line 618, in changed
self.callbacks.process('changed', self)
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/cbook/__init__.py", line 292, in process
self.exception_handler(exc)
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/cbook/__init__.py", line 96, in _exception_printer
raise exc
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/cbook/__init__.py", line 287, in process
func(*args, **kwargs)
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/colorbar.py", line 551, in update_normal
self.draw_all()
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/colorbar.py", line 608, in draw_all
self._add_solids(X, Y, self._values[ind, np.newaxis])
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/colorbar.py", line 624, in _add_solids
self.solids = self.ax.pcolormesh(
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/__init__.py", line 1412, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/axes/_axes.py", line 6058, in pcolormesh
X, Y, C, shading = self._pcolorargs('pcolormesh', *args,
File "/home/eytan/miniconda3/envs/mpl_debug/lib/python3.9/site-packages/matplotlib/axes/_axes.py", line 5533, in _pcolorargs
raise ValueError(
ValueError: x and y arguments to pcolormesh cannot have non-finite values or be of type numpy.ma.core.MaskedArray with masked values

Expected outcome

A pcolormesh figure with a colorbar limit with a minimum of -3 and maximum of -1.

Additional information

Works in version 3.4.3, breaks in version 3.5.0. Could it be related to the fix for #21671 in #21676? It seems like a similar issue and also showed up in version 3.5.0.

Operating system

Ubuntu 20.04

Matplotlib Version

3.5.2

Matplotlib Backend

TkAgg

Python version

3.9.12

Jupyter version

No response

Installation

pip