Featured image of post Cara Menggambar Grafik Menggunakan Python (matplotlib.pyplot)

Cara Menggambar Grafik Menggunakan Python (matplotlib.pyplot)

img_1.png

Prasyarat

  • Akun Google

Langkah-langkah

  1. Akses https://colab.research.google.com/
  2. Pilih “File” -> “Notebook baru”
  3. Tempel dan jalankan kode berikut
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() # tampilkan legenda
plt.show()

Hasil

img.png

Referensi

comments powered by Disqus
Dibangun dengan Hugo
Tema Stack dirancang oleh Jimmy