Plot.java
ptplot@ptolemy.eecs.berkeley.edu
ptplot-announce
alias for announcing
new ptplot releases. This alias is for Ptplot announcements only. Thus,
you cannot post to this group. To subscribe to this group,
send email to ptplot-announce-request@ptolemy.eecs.berkeley.edu
with the word subscribe
in the body, not the header.
xgraph
and ptplot.
pxgraph
, an extension to xgraph
from
ftp://ptolemy.eecs.berkeley.edu/pub/misc/pxgraph/index.html
x
while the mouse is
over the Java pxgraph
application window, and
the X11 version of pxgraph
is installed
as pxgraph.x11
, then pxgraph.x11
will
be started up with the same command line arguments that you called
the Java pxgraph
with. This is one way of using
the Java version most of the time, but still having access to the
MIF output facilities in the X11 version.
http://ptolemy.eecs.berkeley.edu/java/ptplot.html
has links
to the tar and zip files.
http://ptolemy.eecs.berkeley.edu/java/old
.
http://www.javasoft.com
.
The Pxgraph documentation contains further installation instructions.
You can also run Ptplot as an applet in your local browser.
You might find useful information on the Ptplot homepage at
http://ptolemy.eecs.berkeley.edu/java/ptplot
.
If you are really stumped, you can send mail to ptplot@ptolemy.eecs.berkeley.edu
.
Your mail should include:
Plot.java
file.
One is to create a datafile that consists of datasets and x,y pairs
See:
demo/bargraph.plt
Binary data files are also supported, see 3.2 How do I plot binary data?
Another ways it to call plot().addPoint
.
The Fourier Series demo
uses this method.
The PlotFourierSeries class at
demo/PlotFourierSeries.java
is what actually does the plotting.
You can also plot data dynamically by creating a class that has a
addPoints()
method which gets called by the PlotLive class.
The
demo/Live.html
demo
illustrates live plotting.
The PlotLiveDemo class at
demo/PlotLiveDemo.java
is what actually does the plotting.
pxgraph
program.
For details on the format. Ptplot 1.2 and later can also
plot data that consists of raw 4 byte floats.
For more information, see the description of the
-binary
option in
Pxgraph.java
. You might
find the
javadoc Pxgraph documentation
easier to read.
Note that PlotApplication cannot plot binary data yet, only applets and Pxgraph can handle binary data.
pxgraph
and the pxgraphargs
applet parameter take the
following arguments:
-binary
- use the endian format of the machine
that the Java virtual machine is running on.
-bigendian
- the file is in big-endian format,
convert it if the Java virtual machine is running on a little-endian machine.
-littleendian
- the file is in little-endian format,
convert it if the Java virtual machine is running on a big-endian machine.
http://www.best.com/~pvdl/javafaq.html
says:
4.1.11 How do I print a page with an applet?Sun's HotJava browser can be used to print pages that contain applets. However, it seems like the Windows version sometimes crashes when printing. The Solaris version of HotJava1.1 works fine.A. Browsers are starting to introduce support for this. Until they all have it, your best bet is to print a screendump. Using the browser to print the page may leave a blank where the applet is. Putting print support in the applet will print the applet only, not the rest of the browser page.
For more information about printing, join the JavaSoft Developer Connection (it is free) and search for printing.
Note that printing is supported from standalone Pxgraph applications in the Pxgraph class. Note that printing in the Pxgraph class requires JDK1.1 and later.
You might want to use the -print
option to bring up
the print window immediately and the -o
option to specify
an output file for the PostScriptolemy. Below is an example:
pxgraph -print -o /tmp/data.ps demo/data.pltNote that you can also bring up the X11 pxgraph version from after starting the Java version by typing an
x
.
For more information, see
1.6 What is the relationship between xgraph and ptplot?.
To generate a GIF image, you might try first generating PostScript
and then using pstogif
, which is part of Ghostview, available
at
http://www.cs.wisc.edu/~ghost/
. Below is an example:
pxgraph -print -o /tmp/data.ps demo/data.plt pstogif /tmp/data.ps
pxgraphargs
applet parameter can be used to pass
more than one file to the plotter. The pxgraphargs
parameter
can also pass pxgraph
command line arguments.
For example, the HTML below would plot two datafiles at once. The title
of the plot would be Two datafiles
.
<APPLET name="twofiles" CODE="ptolemy.plot.PlotApplet" Height=400 Width=400 codebase="../../.." archive="ptolemy/plot/ptplot.zip" alt="If you had a java-enabled browser, you would see an applet here." > <param name="pxgraphargs" value="-t 'Two datafiles' file1.plt file2.plt"> <hr>If your browser recognized the applet tag, you would see an applet here.<hr> </APPLET>
LogAxes.html
for an applet that has two separate plots side by side.
See
TwoPlotExample.java
for a standalone application that has two separate plots side by side.
PlotApplication.java
is a standalone application with a menu interface. PlotApplication
is started by the ptplot
startup script.
Pxgraph.java
is a standalone application that uses the Plot class.
Pxgraph.java is fairly large, but most of the code is for argument
parsing and backward compatibility with an older program.
Most of the real work is done in the Pxgraph
constructor
and in main()
. Pxgraph can be started from
the pxgraph
script, which is merely a link to
the ptplot
script.
ptolemy/plot/demo/TwoPlotExample.java
is a simple standalone Java application that uses the Plot class.
The comment towards the top of the file contains instructions about
how to compile it.