Saturday , April 4 2020
Home / Berita / Blog Fisika UM / Graphics on Python using PyLab

Graphics on Python using PyLab

Some screenshoot below was taken from my Mac. You may wonder ‘Hey, we render in python using Matplotlib, did’nt we?’. Yeah, pylab is part of matplotlib, so, have fun…

from pylab import grid, xlabel, ylabel, title, plot, ylim, xlim, show, sin, cos
r=10
x=[]y=[]n=19
for i in range(n):
y.append([])
x.append([])
y[i].append(0)
x[i].append(0)
for i in range(n):
phi=7*i
y[i].append(r*sin(phi))
x[i].append(r*cos(phi))
grid(True)
xlabel('Sumbu x')
ylabel('Sumbu y')
title('Jejak ')
plot(x[0],y[0],'b-',x[1],y[1],'g-',
x[2],y[2],'r-',x[3],y[3],'b-',x[4],y[4],'r-')
batas=10
ylim(-batas,batas)
xlim(-batas,batas)
show()
 
From Ubuntu Karmic Koala

from pylab import grid, xlabel, ylabel, title, plot, ylim, xlim, show, sin
from visual import *
x=[]x=arange(-10.,10.,0.1)
grid(True)
xlabel('Sumbu x')
ylabel('Sumbu y')
title('Jejak ')
plot(x,sin(x),'b-')
batas=10
ylim(-2,2)
xlim(-batas,batas)
show()

From Ubuntu Karmic Koala
From Ubuntu Karmic Koala

Check Also

Pengembangan Instrumen Tes Pilihan Ganda Untuk Mengidentifikasi Miskonsepsi Siswa SMA

Tips dan Trik Animasi Swish Max

TIP DAN TRIK PEMBUATAN ANIMASI FISIKA DENGAN PROGRAM APLIKASI SWiSHmax Abstrak: Perkembangan dunia pendidikan dewasa …

Leave a Reply

Your email address will not be published. Required fields are marked *