Numpy + scipy + ipython + matplotlib
-Example of plot: http://matplotlib.sourceforge.net/
Import matplotlib. pyplot as PLT
Import numpy as NP
X, Y = NP. Random. randn (2,100)
Fig = PLT. Figure ()
Ax1 = fig. add_subplot (211)
Ax1.xcorr (X, Y, usevlines = true, maxlags = 50, normed = true, lw = 2)
Ax1.grid (true)
Ax1.axhline (0, color = 'black', lw = 2)
Ax2 = fig. add_subplot (212, sharex = ax1)
Ax2.acorr (x, usevlines = true, normed = true, maxlags = 50, lw = 2)
Ax2.grid (true)
Ax2.axhline (0, color = 'black', lw = 2)
PLT. Show ()
-Save graph to file: http://stackoverflow.com/questions/4325733/save-a-subplot-in-matplotlib
Import Matplotlib . Pyplot As PLT
Import Matplotlib As Mpl
Import Numpy As NP
# Make an example plot with two subplots...
Fig = PLT . Figure ()
Ax1 = Fig . Add_subplot ( 2 , 1 , 1 )
Ax1 . Plot ( Range ( 10 ), 'B -' )
Ax2 = Fig . Add_subplot ( 2 , 1 , 2 )
Ax2 . Plot ( Range ( 20 ), 'R ^' )
# Save the full figure...
Fig . Savefig ( 'Full_figure.png' )
# Save just the portion _ inside _ the second axis's boundaries
Extent = Ax2 . Get_window_extent (). Transformed ( Fig . Dpi_scale_trans . Inverted ())
Fig . Savefig ( 'Ax2_figure.png' , Bbox_inches = Extent )
# Pad the saved area by 10% in the X-direction and 20% in the Y-direction
Fig . Savefig ( 'Ax2_figure_expanded.png' , Bbox_inches = Extent . Expanded ( 1.1 , 1.2 ))
-- Plot 3D data: http://matplotlib.sourceforge.net/plot_directive/mpl_examples/mplot3d/lines3d_demo.py
Import matplotlib as MPL
From mpl_toolkits.mplot3d import axes3d
Import numpy as NP
Import matplotlib. pyplot as PLT
MPL. rcparams ['legend. fontsize'] = 10
Fig = PLT. Figure ()
Ax = fig. GCA (projection = '3d ')
Theta = NP. linspace (-4 * NP. Pi, 4 * NP. Pi, 100)
Z = NP. linspace (-2, 2,100)
R = z ** 2 + 1
X = r * NP. Sin (theta)
Y = r * NP. Cos (theta)
Ax. Plot (X, Y, Z, label = 'parametric curve ')
Ax. Legend ()
PLT. Show ()
-- Pil load & Save image
Import image, imagedraw
Im = image. Open (infile)
Im. Save (OUTFILE, "Jpeg ")
Draw = imagedraw. Draw (IM) # fail to display!
-- Plot image loaded by Pil: (fail !)
Import matplotlib. pyplot as PLT
Import matplotlib. image as mpimg
Import numpy as NP
S = 'B: \ 3dsolar_appltest \ ats201107 \ 0720 \ wisi0003_sawmark0deglargethan15 \ pair0 \ top \ out. tif'
IMG = mpimg. imread (s)
Imgplot = PLT. imshow (IMG)
Axes3d. plot_surface (