|
9 | 9 |
|
10 | 10 | .. toctree:: |
11 | 11 |
|
| 12 | + intro.rst |
12 | 13 | pyplot_tutorial.rst |
13 | 14 | mathtext.rst |
14 | 15 | navigation_toolbar.rst |
|
17 | 18 | event_handling.rst |
18 | 19 |
|
19 | 20 |
|
20 | | -matplotlib is a library for making 2D plots of arrays in `Python |
21 | | -<http://www.python.org>`_. Although it has its origins in emulating |
22 | | -the `MATLAB™ <http://www.mathworks.com>`_ graphics commands, it does |
23 | | -not require MATLAB, and can be used in a Pythonic, object oriented |
24 | | -way. Although matplotlib is written primarily in pure Python, it |
25 | | -makes heavy use of `NumPy <http://www.numpy.org>`_ and other extension |
26 | | -code to provide good performance even for large arrays. |
27 | | - |
28 | | -matplotlib is designed with the philosophy that you should be able to |
29 | | -create simple plots with just a few commands, or just one! If you |
30 | | -want to see a histogram of your data, you shouldn't need to |
31 | | -instantiate objects, call methods, set properties, and so on; it |
32 | | -should just work. |
33 | | - |
34 | | -For years, I used to use MATLAB exclusively for data analysis and |
35 | | -visualization. MATLAB excels at making nice looking plots easy. When |
36 | | -I began working with EEG data, I found that I needed to write |
37 | | -applications to interact with my data, and developed and EEG analysis |
38 | | -application in MATLAB. As the application grew in complexity, |
39 | | -interacting with databases, http servers, manipulating complex data |
40 | | -structures, I began to strain against the limitations of MATLAB as a |
41 | | -programming language, and decided to start over in Python. Python |
42 | | -more than makes up for all of MATLAB's deficiencies as a programming |
43 | | -language, but I was having difficulty finding a 2D plotting package |
44 | | -(for 3D `VTK <http://www.vtk.org/>`_) more than exceeds all of my needs). |
45 | | - |
46 | | -When I went searching for a Python plotting package, I had several |
47 | | -requirements: |
48 | | - |
49 | | -* Plots should look great - publication quality. One important |
50 | | - requirement for me is that the text looks good (antialiased, etc.) |
51 | | - |
52 | | -* Postscript output for inclusion with TeX documents |
53 | | - |
54 | | -* Embeddable in a graphical user interface for application |
55 | | - development |
56 | | - |
57 | | -* Code should be easy enough that I can understand it and extend |
58 | | - it |
59 | | - |
60 | | -* Making plots should be easy |
61 | | - |
62 | | -Finding no package that suited me just right, I did what any |
63 | | -self-respecting Python programmer would do: rolled up my sleeves and |
64 | | -dived in. Not having any real experience with computer graphics, I |
65 | | -decided to emulate MATLAB's plotting capabilities because that is |
66 | | -something MATLAB does very well. This had the added advantage that |
67 | | -many people have a lot of MATLAB experience, and thus they can |
68 | | -quickly get up to steam plotting in python. From a developer's |
69 | | -perspective, having a fixed user interface (the pylab interface) has |
70 | | -been very useful, because the guts of the code base can be redesigned |
71 | | -without affecting user code. |
72 | | - |
73 | | -The matplotlib code is conceptually divided into three parts: the |
74 | | -*pylab interface* is the set of functions provided by |
75 | | -:mod:`matplotlib.pylab` which allow the user to create plots with code |
76 | | -quite similar to MATLAB figure generating code. The *matplotlib |
77 | | -frontend* or *matplotlib API* is the set of classes that do the heavy |
78 | | -lifting, creating and managing figures, text, lines, plots and so on. |
79 | | -This is an abstract interface that knows nothing about output. The |
80 | | -*backends* are device dependent drawing devices, aka renderers, that |
81 | | -transform the frontend representation to hardcopy or a display device. |
82 | | -Example backends: PS creates `PostScript® |
83 | | -<http://http://www.adobe.com/products/postscript/>`_ hardcopy, SVG |
84 | | -creates `Scalable Vector Graphics <http://www.w3.org/Graphics/SVG/>`_ |
85 | | -hardcopy, Agg creates PNG output using the high quality `Anti-Grain |
86 | | -Geometry <http://www.antigrain.com>`_ library that ships with |
87 | | -matplotlib, GTK embeds matplotlib in a `Gtk+ <http://www.gtk.org/>`_ |
88 | | -application, GTKAgg uses the Anti-Grain renderer to create a figure |
89 | | -and embed it a Gtk+ application, and so on for `PDF |
90 | | -<http://www.adobe.com/products/acrobat/adobepdf.html>`_, `WxWidgets |
91 | | -<http://www.wxpython.org/>`_, `Tkinter |
92 | | -<http://docs.python.org/lib/module-Tkinter.html>`_ etc. |
93 | | - |
94 | | -matplotlib is used by many people in many different contexts. Some |
95 | | -people want to automatically generate PostScript® files to send |
96 | | -to a printer or publishers. Others deploy matplotlib on a web |
97 | | -application server to generate PNG output for inclusion in |
98 | | -dynamically-generated web pages. Some use matplotlib interactively |
99 | | -from the Python shell in Tkinter on Windows™. My primary use is to |
100 | | -embed matplotlib in a Gtk+ EEG application that runs on Windows, Linux |
101 | | -and Macintosh OS X. |
102 | | - |
0 commit comments