You can download the matplotlib free from: http://matplotlib.sourceforge.net/

It has, amongst many other things, the module pylab that allows for high quality plotting of data. All you have to do is to feed it a list of x values and the corresponding list of y values calculated from the x data and you are ready to enjoy the plot in its separate window/frame. From there you can zoom the graph, drag the graph, change the margins, and save the graph to a popular image file like PNG.

# Plotting with Pylab

```
# plotting with the pylab module from matplotlib
# free from: http://matplotlib.sourceforge.net/
# used windows istaller matplotlib-0.90.0.win32-py2.5.exe
# tested with Python25 EU 4/21/2007
import math
import pylab # matplotlib
# create the x list data
# arange() is just like range() but allows float numbers
x_list = pylab.arange(0.0, 5.0, 0.01)
# calculate the y list data
y_list = []
for x in x_list:
y = math.cos(2*math.pi*x) * math.exp(-x)
y_list.append(y)
pylab.xlabel("x")
pylab.ylabel("cos(2pi * x) * exp(-x)")
# draw the plot with a blue line 'b' (is default)
# using x,y data from the x_list and y_list
# (these lists can be brought in from other programs)
#
# other drawing styles -->
# 'r' red line, 'g' green line, 'y' yellow line
# 'ro' red dots as markers, 'r.' smaller red dots, 'r+' red pluses
# 'r--' red dashed line, 'g^' green triangles, 'bs' blue squares
# 'rp' red pentagons, 'r1', 'r2', 'r3', 'r4' well, check out the markers
#
pylab.plot(x_list, y_list, 'b')
# save the plot as a PNG image file (optional)
pylab.savefig('Fig1.png')
# show the pylab plot window
# you can zoom the graph, drag the graph, change the margins, save the graph
pylab.show()
```

Arkapravo
0
Newbie Poster

funfullson
0
Junior Poster in Training

Edoch
0
Newbie Poster

vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague

funfullson
0
Junior Poster in Training

Edoch
0
Newbie Poster

sabsab
0
Newbie Poster

vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague

snowbrdr221
0
Newbie Poster

reemolaby
0
Newbie Poster

vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague

_mattb
0
Newbie Poster

TrustyTony
888
pyMod
Team Colleague
Featured Poster

Tech B
48
Posting Whiz in Training

vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague

wasill
0
Newbie Poster

Flintstone_
0
Newbie Poster

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.