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

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

In [3]:
plot(xv,yv)


Out[3]:
[<matplotlib.lines.Line2D at 0x1131f0250>]

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


Out[4]:
[<matplotlib.lines.Line2D at 0x11332b950>]

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


Out[7]:
[None, None, None]

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


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

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


Out[9]:
[None]

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


<matplotlib.figure.Figure at 0x1137e9e50>

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


<matplotlib.figure.Figure at 0x1137f3cd0>

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

In [32]:
close('all')

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

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


Out[35]:
[<matplotlib.lines.Line2D at 0x114802650>]

In [24]:
close(fig2)

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


Out[36]:
[<matplotlib.lines.Line2D at 0x114a75dd0>]

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


Out[18]:
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 0x1140a6cd0>

In [27]:
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[27]:
[<matplotlib.lines.Line2D at 0x11426b5d0>]

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



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


Out[29]:
[<matplotlib.lines.Line2D at 0x11480c410>]

In [41]:
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 [43]:
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 [45]:
mybar = bar(xv, yv, width=1, yerr=0.5)
xticks(range(1,5), ['A', 'B', 'C', 'D'])
setp(mybar, color='r', edgecolor='k')


Out[45]:
[None, None, None, None, None, None, None, None]

In [46]:
close('all')

In [51]:
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[51]:
([<matplotlib.patches.Wedge at 0x1151a0a90>,
  <matplotlib.patches.Wedge at 0x115171050>,
  <matplotlib.patches.Wedge at 0x11513a250>,
  <matplotlib.patches.Wedge at 0x11517ced0>],
 [<matplotlib.text.Text at 0x1151a01d0>,
  <matplotlib.text.Text at 0x115171950>,
  <matplotlib.text.Text at 0x11513a8d0>,
  <matplotlib.text.Text at 0x11517c850>])

In [54]:
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[54]:
[None]

In [57]:
from mpl_toolkits.mplot3d import Axes3D

In [58]:
%matplotlib


Using matplotlib backend: MacOSX

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

In [ ]: