In [6]:
%matplotlib inline
from pylab import *

In [7]:
xv = [1,2,3,4]; yv = [5,1,4,0]

In [8]:
plot(xv,yv)


Out[8]:
[<matplotlib.lines.Line2D at 0x10b3c8090>]

In [9]:
plot(xv,yv,'ro')


Out[9]:
[<matplotlib.lines.Line2D at 0x10bd12110>]

In [10]:
myplot = plot(xv,yv,'k--')
setp(myplot, linewidth = 3.0, marker = '+', markersize = 30)


Out[10]:
[None, None, None]

In [11]:
axis ([0.5,4.5,-0.5,5.5])


Out[11]:
[0.5, 4.5, -0.5, 5.5]

In [12]:
ti = title('my own title')
xl = xlabel('time'); yl = ylabel ('values')
setp(xl, fontweight='bold')


Out[12]:
[None]

In [13]:
savefig('foo.ps', dpi=600, format='ps', orientation='landscape')


<matplotlib.figure.Figure at 0x10bf688d0>

In [14]:
savefig('foo.ps', dpi=600, format='pdf', orientation='landscape')


<matplotlib.figure.Figure at 0x10bf431d0>

In [15]:
myfig = gcf()
close(myfig)

In [16]:
close('all')

In [17]:
fig2 = figure()
subplot(2,1,1)
plot(xv, yv, 'b-')

subplot(2,1,2)
plot(yv, xv, 'ro')


Out[17]:
[<matplotlib.lines.Line2D at 0x10c17e590>]

In [18]:
close(fig2)

In [19]:
fig2= figure(figsize=(10,10))
subplot(2,1,1)
plot(xv, yv, 'b-')
subplot(2,1,2)
plot(yv, xv, 'ro')


Out[19]:
[<matplotlib.lines.Line2D at 0x10bf5fc90>]

In [20]:
xv = np.arange(-10,10.5,0.5); xv


Out[20]:
array([-10. ,  -9.5,  -9. ,  -8.5,  -8. ,  -7.5,  -7. ,  -6.5,  -6. ,
        -5.5,  -5. ,  -4.5,  -4. ,  -3.5,  -3. ,  -2.5,  -2. ,  -1.5,
        -1. ,  -0.5,   0. ,   0.5,   1. ,   1.5,   2. ,   2.5,   3. ,
         3.5,   4. ,   4.5,   5. ,   5.5,   6. ,   6.5,   7. ,   7.5,
         8. ,   8.5,   9. ,   9.5,  10. ])

In [21]:
plot(xv, 2*xv**3-5*xv**2+7*xv)
plot(xv, 2000*cos(xv), 'r--')
text(-9.5,-2800,'curve A')
text(3,1500,'curve B')


Out[21]:
<matplotlib.text.Text at 0x10c7917d0>

In [22]:
close('all'); xv_lin=np.arange(-3,3.01,0.02)
xv = 10**xv_lin
semilogx(xv, exp(-xv/0.01)+0.5*exp(-xv/10)+0.2*exp(-xv/200))


Out[22]:
[<matplotlib.lines.Line2D at 0x10c7de8d0>]

In [23]:
semilogx(xv, exp(-xv/0.01)+0.5*exp(-xv/10)+0.2*exp(-xv/200))
grid(color='k')



In [24]:
semilogy(xv, exp(-xv/0.01)+0.5*exp(-xv/10)+0.2*exp(-xv/200))


Out[24]:
[<matplotlib.lines.Line2D at 0x10cd75150>]

In [25]:
close('all')
xv = [0.5,1.5,2.5,3.5]; yv=[2,5,1,6]
mybar = bar(xv, yv, width=1, yerr=0.5, color='y')



In [26]:
xv = [0.5,1.5,2.5,3.5]; yv=[2,5,1,6]
mybar = bar(range(4), yv, width=1, yerr=0.5, color='g')



In [27]:
mybar = bar(xv, yv, width=1, yerr=0.5)
xticks(range(1,5), ['A', 'B', 'C', 'D'])
setp(mybar, color='r', edgecolor='k')


Out[27]:
[None, None, None, None, None, None, None, None]

In [28]:
close('all')

In [29]:
close('all')
figure(figsize=(5,5))
handles = pie([1,2,3,4], explode=[0.2,0,0,0], shadow=True, labels = ['A', 'B', 'C', 'D'])
handles
# handles[0] [2] --> 3. Text


Out[29]:
([<matplotlib.patches.Wedge at 0x10d156c90>,
  <matplotlib.patches.Wedge at 0x10d1dab90>,
  <matplotlib.patches.Wedge at 0x10d1a3e50>,
  <matplotlib.patches.Wedge at 0x10d0dbbd0>],
 [<matplotlib.text.Text at 0x10d221650>,
  <matplotlib.text.Text at 0x10d1a3fd0>,
  <matplotlib.text.Text at 0x10d0dbc90>,
  <matplotlib.text.Text at 0x10d0e5950>])

In [30]:
figure(figsize=(5,5))
handles = pie([1,2,3,4], explode=[0.2,0,0,0], shadow=True, labels = ['A', 'B', 'C', 'D'])
setp(handles[0] [0], color='y')
setp(handles[1] [0], text='lila Stueck')


Out[30]:
[None]

In [31]:
from mpl_toolkits.mplot3d import Axes3D

In [32]:
%matplotlib


Using matplotlib backend: MacOSX

In [33]:
close('all')
fig=figure(); ax=Axes3D(fig)

from pylab import*


In [34]:
from pylab import*

In [36]:
close('all')
fig=figure(); ax=Axes3D(fig)
import random as rn
xv=[]; yv=[]; zv=[]

for c in range(100):
    xv.append(rn.random()); yv.append(rn.random()); zv.append(rn.random())
    
ax.scatter(xv,yv,zv)


Out[36]:
<mpl_toolkits.mplot3d.art3d.Path3DCollection at 0x10c8e0f90>

In [38]:
close('all')
fig=figure(); ax=Axes3D(fig)
xv=linspace(-10,10,100); yv=linspace(-10,10,100)

cx,cy= meshgrid(xv, yv)
cz= 0.5*cx+exp(-cy**2)
tilt= ax.plot_surface(cx, cy, cz, linewidth=0, cmap=cm.jet)

In [ ]: