Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create grafik_sederhana.py #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions grafik_sederhana.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import matplotlib.pyplot as plt #pastikan kamu telah menginstall matplotlib
#cara install matplotlib --> pip3 install matplotlib

tahun = [1920, 1940, 1960, 1980] #list tahun
nilai = [2.42, 2.56, 2.67, 3.55] #list nilai

plt.plot(tahun, nilai) #menampilkan list tahun1 sebagai sumbu x dan nilai1 sebagai y

plt.xlabel('tahun') #ngasih judul pada sumbu x
plt.ylabel('nilai') #ngasih judul pada sumbu y
plt.title('nilai matematika sd huruhara') #judul grafik
plt.yticks([0, 1, 2, 3, 4, 5]) #mengatur batas sumbu y

plt.show() #method buat nampilin grafiknya. kalo ga jalanin baris ini, maka grafiknya gaakan muncul haha