Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168757
Image: ubuntu2004
from pylab import * clf() plot([10,20,30,40],[100,400,900,1600],'bo') title("Plotagem simples de pontos") savefig('Exemplo1.png')
clf() z=arange(0.0,10.0,0.5) plot(z, z, 'ro', z, z-4, 'gs', z, z**0.5, 'b^') title("Comparacao de curvas no mesmo plano") savefig('Exemplo2.png')
clf() def f(t): return sin(t)-2*cos(pi*t) figure(1) subplot(211) plot(ta,f(ta),'bo',tb,f(tb),'g') ylabel('ta,tb') xlabel('f(ta),f(tb)') title("Comparacao de curvas em planos diferentes") subplot(212) plot(ta,sin(ta)-2*sin(pi*ta),'r--') ylabel('ta') xlabel('sin(ta)-2*sin(pi*ta)') savefig('Exemplo3.png')
clf() mu,sigma =45,20 x = mu + sigma * randn(1000) hist(x,facecolor='r') xlabel('Idade da populacao de Porto Alegre') ylabel('Probabilidade') title('Histograma Populacional') grid(True) savefig('Exemplo4.png')
clf() d = arange(0.0, 5.0, 0.02) s = cos(2*pi*d) line,= plot(d,s) annotate('Aqui', xy=(2.75, 0),arrowprops=dict(facecolor='black')) title('Ferramenta annotate para marcar posicoes') savefig('Exemplo5.png')
clf() r = arange(0, 3.0, 0.01) theta = 2*pi*r polar(theta, r, color='m', lw=3) title('Coordenadas polares') savefig('Exemplo6.png')
clf() pie([2,3,5,10,20,25,35]) title('Graficos do tipo pizza') savefig('Exemplo7.png')
clf() t = arange(0.0, 0.99, 0.01) s = sin(2*2*pi*t) fill(t,s*exp(t), 'g') title('Grafico hachurado') savefig('Exemplo8.png')
clf() x = arange(0,50,1) xlabel('Eixo x - escala normal') y = arange(0,50,1) ly=semilogy(y) ylabel('Eixo y - escala semilog') title('Grafico com escalas diferentes') savefig('Exemplo9.png')
clf() from pylab import * x,y = np.random.randn(2,100) xcorr(x, y, usevlines=True, maxlags=25, normed=True, lw=1.5) title('Grafico de correlacao entre x e y') plt.savefig('Exemplo10.png')