The attached code gives the warning seen below.
If this is intended, should not the close documentation include such a warning too? If not, is there a quick workaround to ignore this warning?
import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as axes3d import numpy as np def plot_sphere(): # Spherical grid. th = np.linspace(0., np.pi, 100) ph = np.linspace(0., 2. * np.pi, 300) theta, phi = np.meshgrid(th, ph) # Plot sphere. x_sphere = np.sin(theta) * np.cos(phi) y_sphere = np.sin(theta) * np.sin(phi) z_sphere = np.cos(theta) fig = plt.figure() ax = fig.add_subplot(1, 1, 1, projection='3d') ax.plot_surface(x_sphere, y_sphere, z_sphere, color='blue') plt.savefig("Test.pdf", bbox_inches="tight") plt.close(fig) def run(): plot_sphere() run()
MatplotlibDeprecationWarning: The close_event function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use callbacks.process('close_event', CloseEvent(...)) instead.
No warning.
No response
Ubuntu 22
3.6.2
GTK4Agg
3.10
pip
That should not be warning and we did not mean to deprecated plt.close.
This appears to be a bug specific to the gtk backend.
FIX: do not use deprecated API in gtk4 backend
Activity
tacaswell commented on Dec 3, 2022
That should not be warning and we did not mean to deprecated plt.close.
This appears to be a bug specific to the gtk backend.
FIX: do not use deprecated API in gtk4 backend
FIX: do not use deprecated API in gtk4 backend
FIX: do not use deprecated API in gtk4 backend
FIX: do not use deprecated API in gtk4 backend
FIX: do not use deprecated API in gtk4 backend
FIX: do not use deprecated API in gtk4 backend