Featured image of post Como desenhar gráficos usando Python (matplotlib.pyplot)

Como desenhar gráficos usando Python (matplotlib.pyplot)

img_1.png

O que você precisa

  • Conta do Google

Passos

  1. Acesse https://colab.research.google.com/
  2. Selecione “Arquivo” -> “Novo notebook”
  3. Cole e execute o código abaixo
1
2
3
4
5
6
7
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2*np.pi, 500)
plt.plot(x, np.sin(x), label="sin curve")
plt.plot(x, np.cos(x), label="cos curve")
plt.legend() # Mostrar legenda
plt.show()

Resultado da execução

img.png

Referências

comments powered by Disqus
Hugo で構築されています。
テーマ StackJimmy によって設計されています。