Postingan

Menampilkan postingan dari Januari 9, 2022

Matplotlib -> Scatter

Gambar
 1. Plot sederhana scatter plot menggunakan matplotlib import matplotlib.pyplot as plt x = [ 2, 4, 6, 8, 10, 11, 11.5, 11.7] y = [1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5 ] #bilang pecahan/ float pada x dan y #plot scatter x dan y plt.scatter(x, y, label='Data 1', color='r') plt.xlabel('Sumbu X') plt.ylabel('Sumbu Y') plt.title('Contoh Scatter Plot') plt.legend() plt.show() (Referensi : Indonesia Belajar = Youtube) 2. Multiple scatter plot x1 = [ 2, 4, 6, 8, 10, 11, 11.5, 11.7] y1 = [1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5 ] #bilang pecahan/ float pada x dan y x2 = [8, 8.5, 9, 9.5, 10, 10.5, 11] y2 = [3, 3.5, 3.7, 4, 4.5, 5, 5.2] #plot scatter x dan y plt.scatter(x1, y1, label='Data 1', color='r') plt.scatter(x2, y2, label='Data 2', color='b') plt.xlabel('Sumbu X') plt.ylabel('Sumbu Y') plt.title('Multiple Scatter Plot') plt.legend() plt.show() 3. Pengaturan marker   x1 = [ 2, 4, 6, 8, 10, 11, 11.5, 11.7] y1 =...