NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
I have put in some update to my 2D X-Y style plotter at http://www.geocities.com/qomo/visad/ major changes are 1) now one can run the demo without recompiling. With VisAD installed, just java -cp "xy.jar;%CLASSPATH%" herschel.spire.qla.plot.Example will do (in Windows). The source and compiled class files are all in one jar file. 2) Functionality-wise I add in support so that one can modify the primitive data array passed to the plotter and let the plotter update the display accordingly. This is still a prototype but quite useable now. ======= 00Readme.txt ======== This package is a quick and dirty prototype. It is an attempt to make it easy for java programmers and end users to make X-Y style line plot, and to control the rendation of the plot, using VisAD. To put it in plain terms, the plotter accepts multiple "plottable" objects, each of which can have multiple Y values and one set of X values. If you only have one set of X values, the plotter can directly accept the X and Y arrays without requiring you to make the plottable object first (it makes an internal one for you). 1) To install: You need to down load VisAD jar at ftp://ftp.ssec.wisc.edu/pub/visad-2.0/visad.jar Put the jar file on your local system if you don't have one already, and put the file name with its full path in your CLASSPATH environment variable. See VisAD home page at http://www.ssec.wisc.edu/~billh/visad.html for more details on installation. 2) If you don't want to compile the source files, see 3) To compile, extract the source files from xy.jar by jar xvf xy.jar then compile. 3) a) Run the Example. It's a mini demo. If you compiled the source files, get the CLASSPATH setup then type java herschel.spire.qla.plot.Example If you don't compile the source files and only want to use the jar file: put the xy.jar with full path in your CLASSPATH, or type something like java -cp "xy.jar;%CLASSPATH%" herschel.spire.qla.plot.Example in Windows or java -cp "xy.jar:$CLASSPATH" herschel.spire.qla.plot.Example in unix Look at the screen after the window pops out and press <enter> when it asks. The source code of Example.java should give you some good ideas how to use this package. b) to play with plotting in Jython (or VisAD's Jython editor): Put xy.jar in your CLASSPATH and type these in Jython command line (I use ">>>" for the Jython prompt): >>>from java.awt import Color >>>from visad import * first, if you don't have anything to plot, this plotter will make some junk data to plot for you, just for testing. >>> p=PlotVisAD2D() you can play with it: (see javeDoc of PlotVisAD2D for more options) for example: >>> p.setBackgroundColor(Color.yellow) There are many more things (about 18 so far) you can set. you need to look at the javaDocs for PlotControlVisAD2D.java . You can plot some data with a one-liner >>> p=PlotVisAD2D([0,1,3,4,6],[[4,2,2,3.5,0]],"foo",["bar"]) or a more relaxed >>> x = [0,1,3,4,6] >>> d0 = [4,2,2,3.5,0] >>> d1 = [1,0,1,0,2] >>> p=PlotVisAD2D(x,[d1, d2],"foo",["bar"],boxColor=Color.orange) Note that after "bar" the name of the data set d1 is not given. "Y1" is used. If you see setXXX()/getXXX() method pairs in PlotControlVisAD2D.java, you can use xXX (lower case for the first letter) like how the above "boxColor" is used when the plot is constructed. Of course you can also do like >>> p.setBoxColor(Color.red) after the plot is constructed. To control the scale rendation, you need first to get the ScaleControl for that axis. At this point it's better to look at the source code of Example.java to figure out. It's all quite simple, for example in Example.java there are these lines: ScaleControlVisAD2D sc1 = p2.getYScaleControl(0,0); ... sc1.setSnapToBox(false); so in Jython you can, after making a plot called "p" above, >>> sc1 = p.getYScaleControl(0,0) >>> sc1.setSnapToBox(0); the "0,0" in getYScaleControl() is for the "plottable" id, and the Y id in that plottable. They all count from 0. So "0,0" means get Y scaleControl for the scale in the 0th plottable of the 0th Y data. To control an individual data line (a pair of X and Y data set), you get the control of it e.g. >>> lc = p.getLineControl(0,0) then do something like >>> lc.setLineWidth(2.0f) Almost anything can be changed programtically (like in Example.java) can be changed in Jython. 4) Note some part (e.g. the direct manipulation and plotting points and lines at the same time) haven't been implemented. Maohai Huang Dec 15, 2002 __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
visad
archives: