Closed
Description
Bug summary
A custom backend that's been working for a few years without a problem, stopped working under Matplotlib 3.6.2.
Code for reproduction
# mpl.py
from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_bases import (_Backend, FigureCanvasBase, FigureManagerBase)
from matplotlib.backends.backend_agg import FigureCanvasAgg
class MyFigureManager(FigureManagerBase):
def show(self):
print("MyFigureManager.show()")
@_Backend.export
class MyBackend(_Backend):
FigureCanvas = FigureCanvasAgg
FigureManager = MyFigureManager
def show(*args, **kwargs):
print("MyBackend.show()")
_Backend.show(*args, **kwargs)
print("MyBackend.show() after _Backend")
# plot_mpl.py
import matplotlib
matplotlib.use("module://mpl")
import matplotlib.pyplot as plt
plt.plot([1,2,3,4,5])
plt.show()
Actual outcome
Running using Matplotlib 3.5.3, this outputs:
MyBackend.show()
MyFigureManager.show()
MyBackend.show() after _Backend
But running using 3.6.2, I get:
MyBackend.show()
.../mpl.py:16: UserWarning: Matplotlib is currently using module://mpl, which is a non-GUI backend, so cannot show the figure.
_Backend.show(*args, **kwargs)
MyBackend.show() after _Backend
In particular, MyFigureManager.show()
is never called.
Expected outcome
Same behavior under both versions.
Operating system
macOS
Matplotlib Version
3.5.3, 3.6.2
Python version
3.10.8
Metadata
Metadata
Assignees
Labels
No labels