@@ -11,8 +11,8 @@ Backends
11
11
What is a backend?
12
12
------------------
13
13
14
- Backends are used for out-putting Matplotlib figures (see :ref: `figure-intro `),
15
- to the screen or for writing to files. A lot of documentation on the website
14
+ Backends are used for displaying Matplotlib figures (see :ref: `figure-intro `),
15
+ on the screen, or for writing to files. A lot of documentation on the website
16
16
and in the mailing lists refers to the "backend" and many new users are
17
17
confused by this term. Matplotlib targets many different use cases and output
18
18
formats. Some people use Matplotlib interactively from the Python shell and
@@ -269,48 +269,56 @@ one is being used:
269
269
270
270
print(matplotlib.get_backend())
271
271
272
- Try a simple plot, as see if the GUI opens:
272
+ Try a simple plot to see if the GUI opens:
273
273
274
274
.. code-block :: python3
275
275
276
276
import matplotlib
277
277
import matplotlib.pyplot as plt
278
278
279
279
print(matplotlib.get_backend())
280
- plt.plot((1,4, 6))
280
+ plt.plot((1, 4, 6))
281
281
plt.show()
282
282
283
283
If it does not, you perhaps have an installation problem. A good step at this
284
284
point is to ensure that your GUI toolkit is installed properly, taking
285
- Matplotlib our of the testing. Almost all GUI toolkits have a small test
285
+ Matplotlib out of the testing. Almost all GUI toolkits have a small test
286
286
program that can be run to test basic functionality. If this test fails, try re-installing.
287
287
288
- PyQt(5,6) and PySide
289
- ^^^^^^^^^^^^^^^^^^^^
288
+ QtAgg
289
+ ^^^^^
290
+
291
+ Test `PyQt5 `:
290
292
291
293
.. code-block :: bash
292
294
293
295
python -c " from PyQt5.QtWidgets import *; app = QApplication([]); win = QMainWindow(); win.show(); app.exec()"
294
296
295
- If you have ``PySide `` or ``PyQt6 `` installed instead , just change the import
297
+ If you have ``PySide `` or ``PyQt6 `` installed rather than `` PyQt5 `` , just change the import
296
298
accordingly.
297
299
298
- tkinter
299
- ^^^^^^^
300
+ TkAgg
301
+ ^^^^^
302
+
303
+ Test ``tkinter ``:
300
304
301
305
.. code-block :: bash
302
306
303
307
python3 -c " from tkinter import Tk; Tk().mainloop()"
304
308
305
- GTK
306
- ^^^
309
+ GTK3Agg, GTK4Agg, GTK3Cairo, GTK4Cairo
310
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
311
+
312
+ Test ``Gtk ``:
307
313
308
314
.. code-block :: bash
309
315
310
- python3 -c " from gi.repository import Gtk; win = Gtk.Window(); win.connect('destroy', Gtk.main_quit); win.show(); Gtk.main()" "
316
+ python3 -c " from gi.repository import Gtk; win = Gtk.Window(); win.connect('destroy', Gtk.main_quit); win.show(); Gtk.main()"
317
+
318
+ wxAgg
319
+ ^^^^^
311
320
312
- wxPython
313
- ^^^^^^^^
321
+ Test `wx `:
314
322
315
323
.. code-block :: python3
316
324
@@ -321,5 +329,5 @@ wxPython
321
329
frame.Show(True) # Show the frame.
322
330
app.MainLoop()
323
331
324
- If the test works for your desired backend then contact us (see
332
+ If the test works for your desired backend but you still cannot get Matplotlib to display a figure, then contact us (see
325
333
:ref: `getting-help `).
0 commit comments