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
http://ptolemy.eecs.berkeley.edu/other/pxgraph.htm
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.htm
has links to the tar and zip files.
The Java Plug-in allows JDK1.1 browsers under Windows to run JDK1.2 applets. As of the 3.1 release of Ptplot, none of the plugins we are shipping require the JDK1.2 Plug-in
Older browsers may not have support for JDK1.1, you may need to upgrade your browser.
Note that Ptplot3.1 and later wll not compile with JDK1.1, the
Plot class uses the clear()
method from the Vector
class, which is not present in JDK1.1.
Ptplot 2.0 supported JDK1.1, and ptplot1.3 and earlier
supported JDK1.0.2, you can find those releases in
http://ptolemy.eecs.berkeley.edu/java/old
.
http://www.javasoft.com
.
See the Installing Ptplot page for more information
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.
The preferred file format is called PlotML, and is described fully in the Plot chapter. It is a textual format in XML, the popular extensible markup language used widely on the internet. An older (and more compact) textual format is also supported. Binary data files are also supported, see 3.2 How do I plot binary data? All three formats are demonstrated in the demos.
If you write Java code, the key method for adding data points is the addPoint() method of the Plot class. The Fourier Series demo uses this method.
You can also plot data dynamically as shown in the live plot demo.
pxgraph
program.
For details on the format see the
javadoc Pxgraph documentation for the PxgraphParser class.
The Java program below shows how to generate a raw binary data file with two data points in it.
cxh@tycho 25% cat BinaryData.java import java.io.*; class BinaryData { public static void main(String args[]) { try { FileOutputStream fileOutput = new FileOutputStream("binary.plt"); DataOutputStream dataOutput = new DataOutputStream(fileOutput); // First pair dataOutput.writeFloat(1); dataOutput.writeFloat(1); // Second pair dataOutput.writeFloat(2); dataOutput.writeFloat(3); dataOutput.close(); fileOutput.close(); } catch (IOException e) { System.out.println("Failed to open a file: " + e); } } } cxh@tycho 26% javac BinaryData.java cxh@tycho 27% setenv CLASSPATH . cxh@tycho 28% java BinaryData cxh@tycho 29% od -c binary.plt 0000000 ? 200 \0 \0 ? 200 \0 \0 @ \0 \0 \0 @ @ \0 \0 0000020 cxh@tycho 30% pxgraph -binary binary.plt
pxgraph
script 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.htm
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 applications (ptplot, pxgraph, and histogram). These applications can also export encapsulated postscript files.
To generate a GIF image, you might try first generating PostScript
by printing to a file or exporting EPS,
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/plotapplet.jar" 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>An alternative is to use ptplot to merge the two files into one plot, then save as a single file.
LogAxes.htm
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. It has derived
classes PlotMLApplication,
which adds the ability to read PlotML files, and
EditablePlotMLApplication, which adds the ability to edit the data being plotted.
EditablePlotMLApplication
is started by the ptplot
startup 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.
Last Updated: $Date: 1999/08/20 15:44:29 $