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

Skip to content

Commit 018d533

Browse files
committed
Merge remote-tracking branch 'upstream/v1.0.x-maint'
2 parents e4a34df + 7381f14 commit 018d533

File tree

6 files changed

+319
-153
lines changed

6 files changed

+319
-153
lines changed

doc/faq/howto_faq.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,9 @@ locators as desired because the two axes are independent::
441441
Generate images without having a window popup
442442
--------------------------------------------------
443443

444-
The easiest way to do this is use an image backend (see
444+
The easiest way to do this is use a non-interactive backend (see
445445
:ref:`what-is-a-backend`) such as Agg (for PNGs), PDF, SVG or PS. In
446-
your figure generating script, just call the
446+
your figure-generating script, just call the
447447
:func:`matplotlib.use` directive before importing pylab or
448448
pyplot::
449449

doc/faq/installing_faq.rst

Lines changed: 0 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -144,148 +144,6 @@ setupegg.py develop` command again to compile them.
144144
There is more information on :ref:`using git <using-git>` in
145145
the developer docs.
146146

147-
Backends
148-
========
149-
150-
.. _what-is-a-backend:
151-
152-
What is a backend?
153-
------------------
154-
155-
A lot of documentation on the website and in the mailing lists refers
156-
to the "backend" and many new users are confused by this term.
157-
matplotlib targets many different use cases and output formats. Some
158-
people use matplotlib interactively from the python shell and have
159-
plotting windows pop up when they type commands. Some people embed
160-
matplotlib into graphical user interfaces like wxpython or pygtk to
161-
build rich applications. Others use matplotlib in batch scripts to
162-
generate postscript images from some numerical simulations, and still
163-
others in web application servers to dynamically serve up graphs.
164-
165-
To support all of these use cases, matplotlib can target different
166-
outputs, and each of these capabilities is called a backend; the
167-
"frontend" is the user facing code, ie the plotting code, whereas the
168-
"backend" does all the hard work behind-the-scenes to make the
169-
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).
172-
173-
There are a two primary ways to configure your backend. One is to set
174-
the ``backend`` parameter in your ``matplotlibrc`` file (see
175-
:ref:`customizing-matplotlib`)::
176-
177-
backend : WXAgg # use wxpython with antigrain (agg) rendering
178-
179-
The other is to use the matplotlib :func:`~matplotlib.use` directive::
180-
181-
import matplotlib
182-
matplotlib.use('PS') # generate postscript output by default
183-
184-
If you use the ``use`` directive, this must be done before importing
185-
:mod:`matplotlib.pyplot` or :mod:`matplotlib.pylab`.
186-
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.
193-
194-
If however, you want to write graphical user interfaces, or a web
195-
application server (:ref:`howto-webapp`), or need a better
196-
understanding of what is going on, read on. To make things a little
197-
more customizable for graphical user interfaces, matplotlib separates
198-
the concept of the renderer (the thing that actually does the drawing)
199-
from the canvas (the place where the drawing goes). The canonical
200-
renderer for user interfaces is ``Agg`` which uses the `Anti-Grain
201-
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
204-
addition, some of the user interfaces support other rendering engines.
205-
For example, with GTK, you can also select GDK rendering (backend
206-
``GTK``) or Cairo rendering (backend ``GTKCairo``).
207-
208-
For the rendering engines, one can also distinguish between `vector
209-
<http://en.wikipedia.org/wiki/Vector_graphics>`_ or `raster
210-
<http://en.wikipedia.org/wiki/Raster_graphics>`_ renderers. Vector
211-
graphics languages issue drawing commands like "draw a line from this
212-
point to this point" and hence are scale free, and raster backends
213-
generate a pixel representation of the line whose accuracy depends on a
214-
DPI setting.
215-
216-
Here is a summary of the matplotlib renderers (there is an eponymous
217-
backed for each):
218-
219-
============= ============ ================================================
220-
Renderer Filetypes Description
221-
============= ============ ================================================
222-
:term:`AGG` :term:`png` :term:`raster graphics` -- high quality images
223-
using the `Anti-Grain Geometry`_ engine
224-
PS :term:`ps` :term:`vector graphics` -- Postscript_ output
225-
:term:`eps`
226-
PDF :term:`pdf` :term:`vector graphics` --
227-
`Portable Document Format`_
228-
SVG :term:`svg` :term:`vector graphics` --
229-
`Scalable Vector Graphics`_
230-
:term:`Cairo` :term:`png` :term:`vector graphics` --
231-
:term:`ps` `Cairo graphics`_
232-
:term:`pdf`
233-
:term:`svg`
234-
...
235-
:term:`GDK` :term:`png` :term:`raster graphics` --
236-
:term:`jpg` the `Gimp Drawing Kit`_
237-
:term:`tiff`
238-
...
239-
============= ============ ================================================
240-
241-
And here are the user interfaces and renderer combinations supported:
242-
243-
============ ================================================================
244-
Backend Description
245-
============ ================================================================
246-
GTKAgg Agg rendering to a :term:`GTK` canvas (requires PyGTK_)
247-
GTK GDK rendering to a :term:`GTK` canvas (not recommended)
248-
(requires PyGTK_)
249-
GTKCairo Cairo rendering to a :term:`GTK` Canvas (requires PyGTK_)
250-
WXAgg Agg rendering to to a :term:`wxWidgets` canvas
251-
(requires wxPython_)
252-
WX Native :term:`wxWidgets` drawing to a :term:`wxWidgets` Canvas
253-
(not recommended) (requires wxPython_)
254-
TkAgg Agg rendering to a :term:`Tk` canvas (requires TkInter_)
255-
QtAgg Agg rendering to a :term:`Qt` canvas (requires PyQt_)
256-
Qt4Agg Agg rendering to a :term:`Qt4` canvas (requires PyQt4_)
257-
FLTKAgg Agg rendering to a :term:`FLTK` canvas (requires pyFLTK_)
258-
macosx Cocoa rendering in OSX windows
259-
============ ================================================================
260-
261-
.. _`Anti-Grain Geometry`: http://www.antigrain.com/
262-
.. _Postscript: http://en.wikipedia.org/wiki/PostScript
263-
.. _`Portable Document Format`: http://en.wikipedia.org/wiki/Portable_Document_Format
264-
.. _`Scalable Vector Graphics`: http://en.wikipedia.org/wiki/Scalable_Vector_Graphics
265-
.. _`Cairo graphics`: http://en.wikipedia.org/wiki/Cairo_(graphics)
266-
.. _`Gimp Drawing Kit`: http://en.wikipedia.org/wiki/GDK
267-
.. _PyGTK: http://www.pygtk.org
268-
.. _wxPython: http://www.wxpython.org/
269-
.. _TkInter: http://wiki.python.org/moin/TkInter
270-
.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/intro
271-
.. _PyQt4: http://www.riverbankcomputing.co.uk/software/pyqt/intro
272-
.. _pyFLTK: http://pyfltk.sourceforge.net
273-
274-
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 :file:`pygobject.h`
281-
to add the :c:macro:`G_BEGIN_DECLS` and :c:macro:`G_END_DECLS` macros,
282-
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-
289147

290148
OS-X questions
291149
==============

0 commit comments

Comments
 (0)