You are here: Home Blog Fisika Graphics on Python using PyLab

Fisika UM

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 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

Related news items:
Newer news items:
Older news items:

 

UM | MIPA | Pimpinan UM | Elearning FMIPA | Physics Book