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

Skip to content

Commit ebe6c5f

Browse files
committed
faq updates
svn path=/trunk/matplotlib/; revision=5336
1 parent b42313b commit ebe6c5f

5 files changed

Lines changed: 79 additions & 10 deletions

File tree

doc/faq/howto_faq.rst

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
*****
2+
HOWTO
3+
*****
4+
5+
How do I use matplotlib in a web application server?
6+
====================================================
7+
8+
Many users report initial problems trying to use maptlotlib in web
9+
application servers, because by default matplotlib ships configured to
10+
work with a graphical user interface which may require an X11
11+
connection. Since many barebones application servers do not have X11
12+
enabled, you may get errors if you don't configure matplotlib for use
13+
in these environments. Most importantly, you need to decide what
14+
kinds of images you want to generate (PNG, PDF, SVG) and configure the
15+
appropriate default backend. For 99% of users, this will be the Agg
16+
backend, which uses the C++ `antigrain <http://antigrain.com`_
17+
rendering engine to make nice PNGs. The Agg backend is also
18+
configured to recognize requests to generate other output formats
19+
(PDF, PS, EPS, SVG). The easiest way to configure matplotlib to use
20+
Agg is to call::
21+
22+
# do this before importing pylab or pyplot
23+
import matplotlib
24+
matplotlib.use('Agg')
25+
import matplotlib.pyplot as plt
26+
27+
Alternatively, you can avoid pylab/pyplot altogeher, which will give
28+
you a little more control, by calling the API directly as shown in
29+
`agg_oo.py <http://matplotlib.sf.net/examples/api/agg_oo.py`_ .
30+
31+
You can either generate hardcopy on the filesystem by calling savefig::
32+
33+
# do this before importing pylab or pyplot
34+
import matplotlib
35+
matplotlib.use('Agg')
36+
import matplotlib.pyplot as plt
37+
fig = plt.figure()
38+
ax = fig.add_subplot(111)
39+
ax.plot([1,2,3])
40+
fig.savefig('test.png')
41+
42+
or by saving to a file handle::
43+
44+
import sys
45+
fig.savefig(sys.stdout)
46+
47+
48+
How do I use matplotlib with apache?
49+
------------------------------------
50+
51+
TODO
52+
53+
How do I use matplotlib with dhango?
54+
------------------------------------
55+
56+
TODO
57+
58+
How do I use matplotlib with zope?
59+
----------------------------------
60+
61+
TODO

doc/faq/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ Frequently asked questions about matplotlib
1313

1414
installing_faq.rst
1515
troubleshooting_faq.rst
16-
plotting_faq.rst
16+
howto_faq.rst
1717

doc/faq/installing_faq.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ install directory. To cleanly rebuild:
2121
* delete ``site-packages/matplotlib`` directory in the Python
2222
installation. The location of ``site-packages`` is
2323
platform-specific.
24+
* you may also want to clear some of the cache data that
25+
matplotlib stores in your ``.matplotlib`` directory. You can
26+
find the location of this directory by doing::
27+
28+
import matplotlib
29+
print matplotlib.get_configdir()

doc/faq/plotting_faq.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

doc/faq/troubleshooting_faq.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ lists first: There's a good chance someone else has already run into
1212
your problem.
1313

1414
If not, please provide the following information in your e-mail to the
15-
mailing list:
15+
`mailing list
16+
<http://lists.sourceforge.net/mailman/listinfo/matplotlib-users>`_:
1617

17-
* your operating system
18-
* matplotlib version
18+
* your operating system; on Linux/UNIX post the output of ``uname -a``
19+
* matplotlib version : ``import matplotlib; print matplotlib.__version__``
1920
* where you obtained matplotlib (e.g. your Linux distribution's
2021
packages or the matplotlib Sourceforge site)
2122
* any customizations to your ``matplotlibrc`` file
22-
* if the problem is reproducible, please try to provide a minimal,
23+
* if the problem is reproducible, please try to provide a *minimal*,
2324
standalone Python script that demonstrates the problem
25+
* you can get very helpful debugging output from matlotlib by
26+
running your script with a ``verbose-helpful`` or
27+
``--verbose-debug`` flags and posting the verbose output the
28+
lists.
2429

2530
If you compiled matplotlib yourself, please also provide
2631

@@ -34,6 +39,8 @@ If you compiled matplotlib yourself, please also provide
3439
platform that are useful for the matplotlib developers to diagnose
3540
your problem.
3641

42+
* your compiler version -- eg, ``gcc --version``
43+
3744
Including this information in your first e-mail to the mailing list
3845
will save a lot of time.
3946

0 commit comments

Comments
 (0)