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]:
In [9]:
plot(xv,yv,'ro')
Out[9]:
In [10]:
myplot = plot(xv,yv,'k--')
setp(myplot, linewidth = 3.0, marker = '+', markersize = 30)
Out[10]:
In [11]:
axis ([0.5,4.5,-0.5,5.5])
Out[11]:
In [12]:
ti = title('my own title')
xl = xlabel('time'); yl = ylabel ('values')
setp(xl, fontweight='bold')
Out[12]:
In [13]:
savefig('foo.ps', dpi=600, format='ps', orientation='landscape')
In [14]:
savefig('foo.ps', dpi=600, format='pdf', orientation='landscape')
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]:
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]:
In [20]:
xv = np.arange(-10,10.5,0.5); xv
Out[20]:
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]:
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]:
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]:
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]:
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]:
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]:
In [31]:
from mpl_toolkits.mplot3d import Axes3D
In [32]:
%matplotlib
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]:
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 [ ]: