You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding a clabel to a contour plot of a subfigure results in a traceback.
Code for reproduction
# Taken from the Contour Demo exampledelta=0.025x=np.arange(-3.0, 3.0, delta)
y=np.arange(-2.0, 2.0, delta)
X, Y=np.meshgrid(x, y)
Z1=np.exp(-(X**2) -Y**2)
Z2=np.exp(-((X-1) **2) - (Y-1) **2)
Z= (Z1-Z2) *2fig=plt.figure()
figs=fig.subfigures(nrows=1, ncols=2)
forfinfigs:
ax=f.subplots()
CS=ax.contour(X, Y, Z)
ax.clabel(CS, inline=True, fontsize=10)
ax.set_title("Simplest default with labels")
plt.show()
Actual outcome
ax.clabel(CS, inline=True, fontsize=10)
File "/usr/lib/python3.9/site-packages/matplotlib/axes/_axes.py", line 6335, in clabel
return CS.clabel(levels, **kwargs)
File "/usr/lib/python3.9/site-packages/matplotlib/contour.py", line 235, in clabel
self.labels(inline, inline_spacing)
File "/usr/lib/python3.9/site-packages/matplotlib/contour.py", line 582, in labels
lw = self._get_nth_label_width(idx)
File "/usr/lib/python3.9/site-packages/matplotlib/contour.py", line 285, in _get_nth_label_width
.get_window_extent(mpl.tight_layout.get_renderer(fig)).width)
File "/usr/lib/python3.9/site-packages/matplotlib/tight_layout.py", line 206, in get_renderer
if fig._cachedRenderer:
AttributeError: 'SubFigure' object has no attribute '_cachedRenderer'
Expected outcome
The two subfigures appearing side by side, each showing the Contour Demo example
Additional information
No response
Operating system
Gentoo
Matplotlib Version
3.5.2
Matplotlib Backend
QtAgg
Python version
3.9.13
Jupyter version
No response
Installation
Linux package manager
The text was updated successfully, but these errors were encountered:
Bug summary
Adding a clabel to a contour plot of a subfigure results in a traceback.
Code for reproduction
Actual outcome
Expected outcome
The two subfigures appearing side by side, each showing the Contour Demo example
Additional information
No response
Operating system
Gentoo
Matplotlib Version
3.5.2
Matplotlib Backend
QtAgg
Python version
3.9.13
Jupyter version
No response
Installation
Linux package manager
The text was updated successfully, but these errors were encountered: