Featured image of post Cómo dibujar un gráfico usando Python (matplotlib.pyplot)

Cómo dibujar un gráfico usando Python (matplotlib.pyplot)

img_1.png

Requisitos

  • Cuenta de Google

Procedimiento

  1. Accede a https://colab.research.google.com/
  2. Selecciona “Archivo” → “Nuevo cuaderno”
  3. Pega y ejecuta el siguiente código:
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() # Muestra la leyenda
plt.show()

Resultado de la ejecución

img.png

Referencias

comments powered by Disqus