Gizeh (that is, Cairo for tourists) is a great interface to the Cairo drawing library.

I recently wished to make a small animation of a bar moving in the visual field and crossing a simple receptive field to illustrate some simple motions that could be captured in the primary visual cortex ansd experiments that could be done there.

importvaporycamera=vapory.Camera('location',[0,2,-3],'look_at',[0,1,2])light=vapory.LightSource([2,4,-3],'color',[1,1,1])sphere=vapory.Sphere([0,1,2],2,vapory.Texture(vapory.Pigment('color',[1,0,1])))scene=vapory.Scene(camera=camera,# a Camera objectobjects=[light,sphere],# POV-Ray objects (items, lights)included=["colors.inc"])# headers that POV-Ray may need# passing 'ipython' as argument at the end of an IPython Notebook cell# will display the picture in the IPython notebook.scene.render('ipython',width=900,height=500)

# import numpy and set the printed precision to something humans can readimportnumpyasnpnp.set_printoptions(precision=2,suppress=True)# set some prefs for matplotlibimportmatplotlib.pyplotaspltimportmatplotlibmatplotlib.rcParams.update({'text.usetex':True})fig_width_pt=700.# Get this from LaTeX using \showthe\columnwidthinches_per_pt=1.0/72.27# Convert pt to inchesfig_width=fig_width_pt*inches_per_pt# width in inchesFORMATS=['pdf','eps']phi=.5*np.sqrt(5)+.5# useful ratio for figures# define plots to be inserted interactively%matplotlib inline
#%config InlineBackend.figure_format='retina' # high-def PNGs, quite bad when using file versioning%config InlineBackend.figure_format='svg'

Below, I detail some thoughts on why it is a perfect preamble for most ipython notebooks.

I needed to show prior information for the orientation of contours in natural images showing a preference for cardinal axis. A polar plot showing seemed to be a natural choice for showing the probability distribution function. However, this seems visually flawed...