21.12.2022 Views

python_para_desenvolvedores_2ed

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Processamento numérico 205

show()

Saída:

Outro exemplo:

from pylab import *

# Dados

ent1 = arange(0., 7., .1)

sai1 = cos(ent1)

sai2 = sin(ent1)

dif = sai2 - sai1

# Divide a figura em 2 linhas e 1 coluna,

# e seleciona a parte superior

subplot(211)

# Plota a curva

# Primeira curva: ent1, sai1, 'bo:'

# Segunda curva: ent1, sai2, 'g^-'

plot(ent1, sai1, 'bo:', ent1, sai2, 'g^-')

# Cria uma legenda

legend(['Cossenos', 'Senos'])

# Seleciona a parte inferior

subplot(212)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!