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

Skip to content

Commit 1415d18

Browse files
committed
faq/installing_faq: update the section on backends
This includes miscellaneous improvements, but is not comprehensive. Note the push towards qt4agg instead of qtagg; the next ipython will support only qt4.
1 parent c96a7d0 commit 1415d18

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

doc/faq/installing_faq.rst

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,10 @@ outputs, and each of these capabilities is called a backend; the
167167
"frontend" is the user facing code, ie the plotting code, whereas the
168168
"backend" does all the hard work behind-the-scenes to make the
169169
figure. There are two types of backends: user interface backends (for
170-
use in pygtk, wxpython, tkinter, qt, macosx, or fltk) and hardcopy backends to
171-
make image files (PNG, SVG, PDF, PS).
170+
use in pygtk, wxpython, tkinter, qt, macosx, or fltk; also
171+
referred to as "interactive backends") and hardcopy backends to
172+
make image files (PNG, SVG, PDF, PS; also referred to as "non-interactive
173+
backends").
172174

173175
There are a two primary ways to configure your backend. One is to set
174176
the ``backend`` parameter in your ``matplotlibrc`` file (see
@@ -184,23 +186,28 @@ The other is to use the matplotlib :func:`~matplotlib.use` directive::
184186
If you use the ``use`` directive, this must be done before importing
185187
:mod:`matplotlib.pyplot` or :mod:`matplotlib.pylab`.
186188

187-
If you are unsure what to do, and just want to get coding, just set
188-
your backend to ``TkAgg``. This will do the right thing for most
189-
users. It gives you the option of running your scripts in batch or
190-
working interactively from the python shell, with the least amount of
191-
hassles, and is smart enough to do the right thing when you ask for
192-
postscript, or pdf, or other image formats.
189+
.. note::
190+
Backend name specifications are not case-sensitive; e.g., 'GTKAgg'
191+
and 'gtkagg' are equivalent.
192+
193+
With a typical installation of matplotlib, such as from a
194+
binary installer or a linux distribution package, a good default
195+
backend will already be set, allowing both interactive work and
196+
plotting from scripts, with output to the screen and/or to
197+
a file, so at least initially you will not need to use either of the
198+
two methods given above.
193199

194-
If however, you want to write graphical user interfaces, or a web
200+
If, however, you want to write graphical user interfaces, or a web
195201
application server (:ref:`howto-webapp`), or need a better
196202
understanding of what is going on, read on. To make things a little
197203
more customizable for graphical user interfaces, matplotlib separates
198204
the concept of the renderer (the thing that actually does the drawing)
199205
from the canvas (the place where the drawing goes). The canonical
200206
renderer for user interfaces is ``Agg`` which uses the `Anti-Grain
201207
Geometry`_ C++ library to make a raster (pixel) image of the figure.
202-
All of the user interfaces can be used with agg rendering, eg
203-
``WXAgg``, ``GTKAgg``, ``QTAgg``, ``TkAgg``, ``CocoaAgg``. In
208+
All of the user interfaces except ``macosx`` can be used with
209+
agg rendering, eg
210+
``WXAgg``, ``GTKAgg``, ``QT4Agg``, ``TkAgg``. In
204211
addition, some of the user interfaces support other rendering engines.
205212
For example, with GTK, you can also select GDK rendering (backend
206213
``GTK``) or Cairo rendering (backend ``GTKCairo``).
@@ -214,7 +221,8 @@ generate a pixel representation of the line whose accuracy depends on a
214221
DPI setting.
215222

216223
Here is a summary of the matplotlib renderers (there is an eponymous
217-
backed for each):
224+
backed for each; these are *non-interactive backends*, capable of
225+
writing to a file):
218226

219227
============= ============ ================================================
220228
Renderer Filetypes Description
@@ -238,7 +246,10 @@ SVG :term:`svg` :term:`vector graphics` --
238246
...
239247
============= ============ ================================================
240248

241-
And here are the user interfaces and renderer combinations supported:
249+
And here are the user interfaces and renderer combinations supported;
250+
these are *interactive backends*, capable of displaying to the screen
251+
and of using appropriate renderers from the table above to write to
252+
a file:
242253

243254
============ ================================================================
244255
Backend Description
@@ -253,9 +264,14 @@ WX Native :term:`wxWidgets` drawing to a :term:`wxWidgets` Canvas
253264
(not recommended) (requires wxPython_)
254265
TkAgg Agg rendering to a :term:`Tk` canvas (requires TkInter_)
255266
QtAgg Agg rendering to a :term:`Qt` canvas (requires PyQt_)
267+
(not recommended; use Qt4Agg)
256268
Qt4Agg Agg rendering to a :term:`Qt4` canvas (requires PyQt4_)
257269
FLTKAgg Agg rendering to a :term:`FLTK` canvas (requires pyFLTK_)
270+
(not widely used; consider TKAgg, GTKAgg, WXAgg, or
271+
QT4Agg instead)
258272
macosx Cocoa rendering in OSX windows
273+
(presently lacks blocking show() behavior when matplotlib
274+
is in non-interactive mode)
259275
============ ================================================================
260276

261277
.. _`Anti-Grain Geometry`: http://www.antigrain.com/
@@ -272,21 +288,6 @@ macosx Cocoa rendering in OSX windows
272288
.. _pyFLTK: http://pyfltk.sourceforge.net
273289

274290

275-
.. _pygtk-2.4:
276-
277-
Compile matplotlib with PyGTK-2.4
278-
-------------------------------------------
279-
280-
There is a `bug in PyGTK-2.4`_. You need to edit
281-
:file:`pygobject.h` to add the :c:macro:`G_BEGIN_DECLS` and :c:macro:`G_END_DECLS`
282-
macros, and rename :c:data:`typename` parameter to :c:data:`typename_`::
283-
284-
- const char *typename,
285-
+ const char *typename_,
286-
287-
.. _`bug in PyGTK-2.4`: http://bugzilla.gnome.org/show_bug.cgi?id=155304
288-
289-
290291
OS-X questions
291292
==============
292293

0 commit comments

Comments
 (0)