An excellent way to display a function
of two variables, , is to form
a color image whereby the color of each
pixel corresponds to the value of
at that location. The tool to accomplish
this must translate the function range
to a color palette range. For our
purpose, this tool must read in a
2-dimensional array containing the values
of
on a 2-dimensional lattice
and produce the color image.
The python script
plot_image.py
does precisely this. It is based
on the matplotlib.
matplotlib is a Python 2-dimension plotting library which produces publication quality figures with great flexibility in a variety of formats. The web site describes how to download, install and use this library. The tutorials, user's guide and examples found in this site are easier to read by a reader with some previous knowledge of Python and Numerical Python.
Use
gen_data.c
gen_data_sharp.c
gen_data_rectangle.c
to form simple images by feeding sample data in plot_image.py.
These codes produce
images of size (
)
and (
)
for the third code respectively.
Read the comments
in plot_image.py to learn how to use it.
Practice the different options.
Michel Vallieres 2011-02-02