Using the "Quick Graph" functions

May, 2001

Introduction

If you have the need for quick visualization of your simple field type data, we have provided a Python script, graph.py which includes several 2-D displays in simple formats: This page describes each of these in detail. There are several common keyword parameters for all these functions: Note that prior to using any of the methods from the graph.py script, you must either:
import graph
or you must:
from graph import *
If you choose the first form, the all your references to methods in must include "graph" -- that is: graph.histogram(data). If you use the second form then you omit the "graph" -- that is: histogram(data).

You may also have to import other things. For example, to use the Java Color, you will have to:

from java.awt import Color
for example.

If you want, you can look at the Jython code for graph.py.


Image

A simple display of a gray-scale image. This code:
a=load("../data/mcidas/AREA0001")
graph.image(a)
produces this display:

Picture of satellite image with gray scale


Scatter Plot

A scatter diagram, where the range values of one parameter are plotted against the range values for another.
a=load("../data/mcidas/AREA0008")
b = extract(a,0)
c = extract(a,1)
graph.scatter(b,c)
produces this display:

Picture of scatter plot


Histogram

A simple traditional "bar-graph" style of a histogram.
a=load("../data/mcidas/AREA0001")
graph.histogram(a, 40, color=Color.cyan)
produces this display:

Picture of histogram plot


Line Plot

A simple single line plot.
a=field( (1,2,3,1,2,3,1,2,3,1,2,3))
graph.lineplot(a, color=Color.orange)
produces this display:

Picture of line plot


Contour

A simple display of iso-contours. This code:
a=load("../data/text/example1.txt")
graph.contour(a)
produces this display:

Picture of contour plot


Animation

A simple display of an animation of images, including the VisAD Animation Widget. This code:
a=load("../examples/images.nc")
graph.animation(a)
produces this display:

Picture of VisAD animation window

You can also just use a sequence of JPEG or GIF images. For example:

a=load("image0.jpg")
b=load("image1.jpg")
c=load("image2.jpg")
graph.animation( (a,b,c) )


Back to the home page