User Tools

Site Tools


python

Python

VirtualEnv/PyPlot

To enable use of site packages:

$ workon scipy
$ toggleglobalsitepackages

Use GTK antigrain (agg) backend in PyPlot:

$ ipython
[1] import matplotlib
[2] matplotlib.use('GTKagg')
[3] import matplotlib.pyplot as plt

If [3] succeeds, you're set. If it fails, you may need to recompile matplotlib after adding site-packages to the virtual environment.

Also see http://matplotlib.org/faq/usage_faq.html#what-is-a-backend

For vector rendering output, you need to use something else than Agg. Refer to the backend documentation for this!

iPython

  • Launch iPython qtconsole with inline images

$ ipython qtconsole --pylab=inline

  • Startup scripts running from iPython config directory, which you can get via

$ ipython locate

  • The startup file would look something like either of

$ cat ~/.config/ipython/profile_default/startup/00-astro.py
$ cat ~/.ipython/profile_default/startup/00-astro.py

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

print ""
print "**********************************************************************************"
print "*** Default Imports: numpy as np, matplotlib as mpl, matplotlib.pyplot as plt. ***"
print "**********************************************************************************"

iPython Notebook

$ ipython notebook --pylab=inline --no-browser --ip=*

Other Stuff

python.txt · Last modified: 2013/12/07 11:14 by Volker