@@ -248,3 +248,67 @@ backend, use ``module://name.of.the.backend`` as the backend name, e.g.
248
248
``matplotlib.use('module://name.of.the.backend') ``.
249
249
250
250
Information for backend implementers is available at :ref: `writing_backend_interface `.
251
+
252
+ .. _plots_not_showing :
253
+
254
+ Debugging figure windows not showing
255
+ ------------------------------------
256
+
257
+ Sometimes things do not work as expected, usually during an install.
258
+
259
+ If you are using a Notebook or integrated development environment (PyCharm),
260
+ please consult their documentation for debugging plots not showing up.
261
+
262
+ If you are using one of Matplotlib's graphics backends, make sure you know which
263
+ one is being used:
264
+
265
+ .. code-block :: python3
266
+ import matplotlib
267
+
268
+ print(matplotlib.get_backend())
269
+
270
+ Try a simple plot, as see if the GUI opens:
271
+
272
+ .. code-block :: python3
273
+ import matplotlib
274
+ import matplotlib.pyplot as plt
275
+
276
+ print(matplotlib.get_backend())
277
+ plt.plot((1,4,6))
278
+ plt.show()
279
+
280
+ If it does not, you perhaps have an installation problem. A good step at this
281
+ point is to ensure that your GUI toolkit is installed properly, taking
282
+ Matplotlib our of the testing. Almost all GUI toolkits have a small test
283
+ program that can be run to test basic functionality. If these fail, try re-installing.
284
+
285
+ PyQT
286
+ ^^^^
287
+
288
+ .. code-block :: bash
289
+ python -c " from PyQt5.QtWidgets import *; app = QApplication([]); win = QMainWindow(); win.show(); app.exec()"
290
+
291
+ or if you have installed `PyQt6 `:
292
+
293
+ .. code-block :: bash
294
+ python -c " from PyQt6.QtWidgets import *; app = QApplication([]); win = QMainWindow(); win.show(); app.exec()"
295
+
296
+ GTK
297
+ ^^^
298
+
299
+ .. code-block :: bash
300
+ python3 -c ' from gi.repository import Gtk; win = Gtk.Window(); win.connect("destroy", Gtk.main_quit); win.show(); Gtk.main()'
301
+
302
+ wxPython
303
+ ^^^^^^^^
304
+
305
+ .. code-block :: python3
306
+ import wx
307
+
308
+ app = wx.App(False) # Create a new app, don't redirect stdout/stderr to a window.
309
+ frame = wx.Frame(None, wx.ID_ANY, "Hello World") # A Frame is a top-level window.
310
+ frame.Show(True) # Show the frame.
311
+ app.MainLoop()
312
+
313
+ If the test works for your desired backend then contact us (see
314
+ :ref: `getting-help `).
0 commit comments