Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d2f2bc0

Browse files
committed
Update backends docs.
1 parent d4957ec commit d2f2bc0

File tree

2 files changed

+68
-66
lines changed

2 files changed

+68
-66
lines changed

doc/users/whats_new/qtcairo.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Cairo rendering for Qt canvases
2+
-------------------------------
3+
4+
The new ``Qt4Cairo`` and ``Qt5Cairo`` backends allow Qt canvases to use Cairo
5+
rendering instead of Agg.

tutorials/introductory/usage.py

Lines changed: 63 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,18 @@ def my_plotter(ax, data1, data2, param_dict):
322322
# backend : WXAgg # use wxpython with antigrain (agg) rendering
323323
#
324324
# #. Setting the :envvar:`MPLBACKEND` environment
325-
# variable, either for your current shell or for a single script::
325+
# variable, either for your current shell or for a single script. On Unix::
326326
#
327-
# > export MPLBACKEND="module://my_backend"
327+
# > export MPLBACKEND=module://my_backend
328328
# > python simple_plot.py
329329
#
330330
# > MPLBACKEND="module://my_backend" python simple_plot.py
331331
#
332+
# On Windows, only the former is possible::
333+
#
334+
# > set MPLBACKEND=module://my_backend
335+
# > python simple_plot.py
336+
#
332337
# Setting this environment variable will override the ``backend`` parameter
333338
# in *any* ``matplotlibrc``, even if there is a ``matplotlibrc`` in your
334339
# current working directory. Therefore setting :envvar:`MPLBACKEND`
@@ -360,19 +365,18 @@ def my_plotter(ax, data1, data2, param_dict):
360365
# methods given above.
361366
#
362367
# If, however, you want to write graphical user interfaces, or a web
363-
# application server (:ref:`howto-webapp`), or need a better
364-
# understanding of what is going on, read on. To make things a little
365-
# more customizable for graphical user interfaces, matplotlib separates
366-
# the concept of the renderer (the thing that actually does the drawing)
367-
# from the canvas (the place where the drawing goes). The canonical
368-
# renderer for user interfaces is ``Agg`` which uses the `Anti-Grain
369-
# Geometry`_ C++ library to make a raster (pixel) image of the figure.
370-
# All of the user interfaces except ``macosx`` can be used with
371-
# agg rendering, e.g.,
372-
# ``WXAgg``, ``GTKAgg``, ``QT4Agg``, ``QT5Agg``, ``TkAgg``. In
373-
# addition, some of the user interfaces support other rendering engines.
374-
# For example, with GTK, you can also select GDK rendering (backend
375-
# ``GTK`` deprecated in 2.0) or Cairo rendering (backend ``GTKCairo``).
368+
# application server (:ref:`howto-webapp`), or need a better understanding of
369+
# what is going on, read on. To make things a little more customizable for
370+
# graphical user interfaces, matplotlib separates the concept of the renderer
371+
# (the thing that actually does the drawing) from the canvas (the place where
372+
# the drawing goes). The canonical renderer for user interfaces is ``Agg``
373+
# which uses the `Anti-Grain Geometry`_ C++ library to make a raster (pixel)
374+
# image of the figure. All of the user interfaces except ``macosx`` can
375+
# be used with Agg rendering, e.g., ``GTKAgg``, ``GTK3Agg``, ``Qt4Agg``,
376+
# ``Qt5Agg``, ``TkAgg``, ``WxAgg``. In addition, some of the user interfaces
377+
# support other rendering engines. For example, with GTK, GTK3, and QT5,
378+
# you can also select Cairo rendering (backends ``GTKCairo``, ``GTK3Cairo``,
379+
# ``Qt5Cairo``).
376380
#
377381
# For the rendering engines, one can also distinguish between `vector
378382
# <https://en.wikipedia.org/wiki/Vector_graphics>`_ or `raster
@@ -397,65 +401,61 @@ def my_plotter(ax, data1, data2, param_dict):
397401
# `Portable Document Format`_
398402
# SVG :term:`svg` :term:`vector graphics` --
399403
# `Scalable Vector Graphics`_
400-
# :term:`Cairo` :term:`png` :term:`vector graphics` --
401-
# :term:`ps` `Cairo graphics`_
402-
# :term:`pdf`
404+
# :term:`Cairo` :term:`png` :term:`raster graphics` and
405+
# :term:`ps` :term:`vector graphics` -- using the
406+
# :term:`pdf` `Cairo graphics`_ library
403407
# :term:`svg`
404-
# ...
405408
# ============= ============ ================================================
406409
#
407410
# And here are the user interfaces and renderer combinations supported;
408411
# these are *interactive backends*, capable of displaying to the screen
409412
# and of using appropriate renderers from the table above to write to
410413
# a file:
411414
#
412-
# ============ ================================================================
413-
# Backend Description
414-
# ============ ================================================================
415-
# Qt5Agg Agg rendering in a :term:`Qt5` canvas (requires PyQt5_). This
416-
# backend can be activated in IPython with ``%matplotlib qt5``.
417-
# ipympl Agg rendering embedded in a Jupyter widget. (requires ipympl)
418-
# This can be enabled in a Jupyter notebook with
419-
# ``%matplotlib ipympl``
420-
# GTK3Agg Agg rendering to a :term:`GTK` 3.x canvas (requires PyGObject_
421-
# and pycairo_ or cairocffi_)
422-
# This backend can be activated in IPython with
423-
# ``%matplotlib gtk3``.
424-
# macosx Agg rendering into a Cocoa canvas in OSX.
425-
# This backend can be activated in IPython with
426-
# ``%matplotlib osx``.
427-
# TkAgg Agg rendering to a :term:`Tk` canvas (requires TkInter_).
428-
# This backend can be activated in IPython with
429-
# ``%matplotlib tk``.
430-
# nbAgg Embed an interactive figure in a Jupyter classic notebook. This
431-
# backend can be enabled in Jupyter notebooks via
432-
# ``%matplotlib notebook``.
433-
# WebAgg On ``show()`` will start a tornado server with an interactive
434-
# figure.
435-
# GTK3Cairo Cairo rendering to a :term:`GTK` 3.x canvas (requires PyGObject_
436-
# and pycairo_ or cairocffi_)
437-
# Qt4Agg Agg rendering to a :term:`Qt4` canvas (requires PyQt4_
438-
# or ``pyside``).
439-
# This backend can be activated in IPython with
440-
# ``%matplotlib qt4``.
441-
# GTKAgg Agg rendering to a :term:`GTK` 2.x canvas (requires PyGTK_ and
442-
# pycairo_ or cairocffi_; Python2 only)
443-
# This backend can be activated in IPython with
444-
# ``%matplotlib gtk``.
445-
# GTKCairo Cairo rendering to a :term:`GTK` 2.x canvas (requires PyGTK_
446-
# and pycairo_ or cairocffi_; Python2 only)
447-
# WXAgg Agg rendering to a :term:`wxWidgets` canvas
448-
# (requires wxPython_. v4.0 (in beta) is
449-
# required for python3).
450-
# This backend can be activated in IPython with
451-
# ``%matplotlib wx``.
452-
# ============ ================================================================
415+
# ========= ================================================================
416+
# Backend Description
417+
# ========= ================================================================
418+
# Qt5Agg Agg rendering in a :term:`Qt5` canvas (requires PyQt5_). This
419+
# backend can be activated in IPython with ``%matplotlib qt5``.
420+
# ipympl Agg rendering embedded in a Jupyter widget. (requires ipympl).
421+
# This backend can be enabled in a Jupyter notebook with
422+
# ``%matplotlib ipympl``.
423+
# GTK3Agg Agg rendering to a :term:`GTK` 3.x canvas (requires PyGObject_,
424+
# and pycairo_ or cairocffi_). This backend can be activated in
425+
# IPython with ``%matplotlib gtk3``.
426+
# macosx Agg rendering into a Cocoa canvas in OSX. This backend can be
427+
# activated in IPython with ``%matplotlib osx``.
428+
# TkAgg Agg rendering to a :term:`Tk` canvas (requires TkInter_). This
429+
# backend can be activated in IPython with ``%matplotlib tk``.
430+
# nbAgg Embed an interactive figure in a Jupyter classic notebook. This
431+
# backend can be enabled in Jupyter notebooks via
432+
# ``%matplotlib notebook``.
433+
# WebAgg On ``show()`` will start a tornado server with an interactive
434+
# figure.
435+
# Qt5Cairo Cairo rendering in a :term:`Qt5` canvas (requires PyQt5_ and
436+
# cairocffi_).
437+
# GTK3Cairo Cairo rendering to a :term:`GTK` 3.x canvas (requires PyGObject_,
438+
# and pycairo_ or cairocffi_).
439+
# Qt4Agg Agg rendering to a :term:`Qt4` canvas (requires PyQt4_ or
440+
# ``pyside``). This backend can be activated in IPython with
441+
# ``%matplotlib qt4``.
442+
# Qt4Cairo Cairo rendering in a :term:`Qt5` canvas (requires PyQt5_ and
443+
# cairocffi_).
444+
# GTKAgg Agg rendering to a :term:`GTK` 2.x canvas (requires PyGTK_, and
445+
# pycairo_ or cairocffi_; Python2 only). This backend can be
446+
# activated in IPython with ``%matplotlib gtk``.
447+
# GTKCairo Cairo rendering to a :term:`GTK` 2.x canvas (requires PyGTK_,
448+
# and pycairo_ or cairocffi_; Python2 only).
449+
# WXAgg Agg rendering to a :term:`wxWidgets` canvas (requires wxPython_;
450+
# v4.0 (in beta) is required for Python3). This backend can be
451+
# activated in IPython with ``%matplotlib wx``.
452+
# ========= ================================================================
453453
#
454454
# .. _`Anti-Grain Geometry`: http://antigrain.com/
455455
# .. _Postscript: https://en.wikipedia.org/wiki/PostScript
456456
# .. _`Portable Document Format`: https://en.wikipedia.org/wiki/Portable_Document_Format
457457
# .. _`Scalable Vector Graphics`: https://en.wikipedia.org/wiki/Scalable_Vector_Graphics
458-
# .. _`Cairo graphics`: https://en.wikipedia.org/wiki/Cairo_(graphics)
458+
# .. _`Cairo graphics`: https://wwW.cairographics.org
459459
# .. _`Gimp Drawing Kit`: https://en.wikipedia.org/wiki/GDK
460460
# .. _PyGTK: http://www.pygtk.org
461461
# .. _PyGObject: https://wiki.gnome.org/action/show/Projects/PyGObject
@@ -489,11 +489,8 @@ def my_plotter(ax, data1, data2, param_dict):
489489
# GTK and Cairo
490490
# -------------
491491
#
492-
# Both `GTK2` and `GTK3` have implicit dependencies on PyCairo regardless of the
493-
# specific Matplotlib backend used. Unfortunatly the latest release of PyCairo
494-
# for Python3 does not implement the Python wrappers needed for the `GTK3Agg`
495-
# backend. `Cairocffi` can be used as a replacement which implements the correct
496-
# wrapper.
492+
# Both `GTK2` and `GTK3` depend on a Cairo wrapper (PyCairo or cairocffi) even
493+
# if the Agg renderer is used. On Python3, only cairocffi is supported.
497494
#
498495
# How do I select PyQt4 or PySide?
499496
# --------------------------------

0 commit comments

Comments
 (0)