#
Plotting with `matplotlib`

The matplotlib library (http://matplotlib.sourceforge.net `http://matplotlib.sourceforge.net`) provides high quality 2D plotting for Python. Matplotlib can produce plots on screen using a variety of GUI toolkits, including Tk, GTK and WXPython. It also provides a number of commands useful for scientific computing, all with a syntax compatible with that of the popular Matlab program.

IPython accepts the special option `-pylab` (Sec. 5.2). This configures it to support matplotlib, honoring the settings in the `.matplotlibrc` file. IPython will detect the user's choice of matplotlib GUI backend, and automatically select the proper threading model to prevent blocking. It also sets matplotlib in interactive mode and modifies `%run` slightly, so that any matplotlib-based script can be executed using `%run` and the final `show()` command does not block the interactive shell.

The `-pylab` option must be given first in order for IPython to configure its threading mode. However, you can still issue other options afterwards. This allows you to have a matplotlib-based environment customized with additional modules using the standard IPython profile mechanism (Sec. 7.3): ```ipython -pylab -p myprofile`'' will load the profile defined in `ipythonrc-myprofile` after configuring matplotlib.