kPlot: animation of numerical data on the internet


 
 

kPlot is a Java program that allows to animate numerical data. It can be used to examine your own experimental results/numerical simulations, or to publish an animation on the internet. All you need is a post-1997 web browser (for details see below).

Currently kPlot has the following features:

Before explaining more you may want to see an example:



Table of Contents

What do I need to run kPlot?
How do I install kPlot on my computer?
How do I publish an animation on the web?
How do I prepare the numerical data for animation?
Providing information to the graphs
Options
Known bugs


What do I need to run kPlot?

kPlot is written in Java 1.1 which means that it only runs with post-1997 browsers. To be specific, you either need Netscape Communicator 4.5 or Microsoft Internet Explorer 4.01 or later. I don't know about browsers of other companies, but their newer products probably would do. I recommend Netscape since it allows you to view your own data locally on your PC.

To avoid huge files to be loaded over the internet kPlot does not work with the original data files but needs the data to be pre-compiled. You therefore need a C-compiler to run the The data compiler program. This program is simple and easy to use.

Finally, in order to look at the animations, you must set up an .html file like this web page on your computer. You might just copy this one and make some small changes or write it completely new. In any way, you will need a tiny bit of knowledge about how an .html file works.


How do I install kPlot on my computer?

This is very easy. Just copy the java file of kPlot in some directory of your computer. Then, in the same directory, create an .html file containing the lines

<APPLET archive=plothh.jar code=plothh.class height=380 width=550 >
</APPLET>

(If you are using a WYSIWYG program like Netscape Composer of Microsoft FrontPage Express you have to insert a corresponding applet-tag).

Actually, because the security manager of the Internet Explorer is not written appropriately, you will not be able to view any locally stored animations with it. You therefore need Netscape's Communicator to view your own files locally. But to avoid misunderstandings: both browsers allow you to view animations on the internet.


How do I publish an animation on the web?

Essentially in the same way. Just copy the java file of kPlot in the directory of your homepage and create an .html file for it. The only difference is that now no files can be loaded while kPlot is running. You therefore have to tell kPlot the name of the animations (which should be in the same directory) before it starts. For example, on this web page I essentially used the following code:

<APPLET archive=plothh.jar code=plothh.class height=380 width=550 >
 <PARAM name="PlotFile1"
  value="http://physics.stfx.ca/~pmarzlin/kplot/fmodulus.kpm">
  <PARAM name="PlotFile2"
  value="http://physics.stfx.ca/~pmarzlin/kplot/fpotentl.kpm">
</APPLET>

The two parameters PlotFile1 and PlotFile2 inform kPlot which animations are to be displayed. You can provide up to four http addresses (which, however, should all be on the same server). You also can use these PARAMeters if you run kPlot locally.


How do I prepare the numerical data for animation?

Preparation of you numerical data is necessary to reduce the size of the file to be downloaded from the web. To do so you have to compile your numerical data file using the C-prgram num2kpm. This program assumes that your original datafile contains nothing but your numerical data in a form readable to humans. For instance, if you have made a numerical simulation with two spatial points and three time steps your file should contain 2x3=6 real numbers (or 12 real numbers if your simulation produces complex numbers). Just tell num2kpm how much x-steps and time steps you have and which files you want to use:

num2kpm -t3 -x2 dataFile.num compiledFile.kpm

The file compiledFile.kpm then can be displayed by kPlot.


Providing information on the graphs

kPlot offers a possibility to explain the details of any of your graphs. The numerical data of a graph are stored in a .kpm file (kPlot Main file), let's say example.kpm. kPlot then automatically searches for a file example.kpi (kPlot info file) in the same directory as example.kpm. If it finds such a file the user can look at its content by using the buttons above the animation ("Information on graphs"). The .kpi file is a simple text file (not Word or latex or rtf, just a plain text file) that can contain just a word or lengthy explanations.


Options

kPlot offers a whole bunch of parameters that can be used to customize the start-up of the program. You already encountered two of them in the paragraph on how to publish animations on the web:

<PARAM name="PlotFile1" value="location">

This allows you to load a file without using the file dialog from the menu. "location" can be just the name of the file if you have installed kPlot locally, or the complete url of a file on the web (as above). You can provide up to four files (PlotFile1 to PlotFile4).

If you want to in-/decrease the size of individual graphs you can provide the percentage of height compared to the original size. For instance, the option

<PARAM name="PlotHeightPercentage1" value="250">

inreases the height of the first graph to 250 percent of its original height.

You probably would like to add lables to the axes of the graphs. This can be done by using the code

<PARAM name="xPlotLabel" value="this appears at the x-axis">
<PARAM name="yPlotLabel" value="this appears at the y-axis">

Right now this option is not very elaborated (it does not allow any special characters, change of size and so on), but it works. Maybe I will improve it if there is enough demand (feedback is always the driving force for a programmer to improve an existing program).

If you don't like the default colors of kPlot do not be desperate. You can change almost any color in use with the following options:

<PARAM name="AppletBackgroundColor" value="000000">
<PARAM name="PlotBackgroundColor" value="F0F0C8">
<PARAM name="PlotColor3" value="AA7823">

"AppletBackgroundColor" is the color of the background of kPlot, "PlotBackgroundColor" is the color of the background behind the graphs, and "PlotColor3" is the color of the third graph (as usual you have PlotColor1 to PlotColor4). The value of the color is given in the same way as it is done for all web pages: it is a three-byte hexadecimal number where the bytes provide the intensity of red, green, and blue, respectively. For example, "000000" means red=0, green=0, blue=0, i.e., black. Bright red, green, and blue are given by "FF0000", "00FF00", and "0000FF", respectively. White is "FFFFFF".

If you publish an animation on the web you might not want the user to change the appearance of kPlot after you have spent so much time to get the right colors, the right height and so on. For this reason, you can disable some of the menu entries:

<PARAM name="fileMenuDisabled" value="true">
<PARAM name="colorMenuDisabled" value="true">
<PARAM name="heightMenuDisabled" value="true">

The option "fileMenuDisabled" removes the file dialog from the menu. I would do this all the time when using kPlot on a web page (I didn't do it above for demonstration purposes only). "colorMenuDisabled" disallows the user to change any colors, and "heightMenuDisabled" prevents that the height of the graphs can be changed.

Finally, you might not want kPlot to loop your animation endlessy. For this reason I added the "loop" button which toggles between endless mode and just one round each when the play button (">" or "<") is hit. While the user can always toggle using the loop button, you can determine the initial state of this button by using the option

<PARAM name="playLoop" value="true">

Known bugs

General:

When using Microsoft Internet Explorer (IE):

When using Netscape Communicator:



  Home          Contact          Research          Teaching       


Keine Verbindung moeglich!