RtPlot - Version 0.55

Copyright © Dov Bai (1999-2003)

contents:

Version history

Summary

RtPlot is a small program for displaying 2D plots in real time. It consumes little resources. It was written because of the need to monitor the progress of computationally intensive scientific programs which run for a long time and occasionally produce output suitable for plotting. The user can open as many windows as needed for plotting. Each window can monitor several data files and plot their contents. When a data file is updated by another concurrently running program, its plot is automatically updated as well. It is also possible to view in a window several recent updates to a data file. The user can configure the frequency in which RtPlot checks for file updates, stop or renew the updating of plots, the range of x & y columns, number of ticks along axes and other parameters. Configurations can be made with the mouse, command line or XML configuration files. Each plot can be printed or saved in BMP/PNG formats either manually or when the display is updated.

Package Contents:

The package includes the following files:
  1. rtplot.exe - RtPlot executable.
  2. readme.html - this file

The following files are included for demonstration purposes (see below):

  1. plottest.exe - Executable for creating cosine & sine plots.
  2. testplot.xml - XML configuration file for the data files generated by plottest.exe.
  3. testplot.cpp - Source code for plottest.exe

The following file is Simtel xml file. It is not required for using RtPlot.

  1. rtplt055.xml

Usage:

To open a new plot window click File->New Plot in the initial menu. A dialog box opens with default values of ranges of x & y ([x-min,x-max], [y-min, y-max]), and possibly with default file name. You may edit the values in this dialog. "x-col" is the column in the data file used as x-axis, "y-col" is the y-axis. If there are only two data columns in the file, normally "x-col" is the first (0) column and "y-col" is the second (1). With more than two columns, it is possible to change to different columns.

To open the new window maximized, check the Open maximized check box. To activate auto x scrolling, check the auto x scroll checkbox.

Alternatively, you may load a previously saved configuration from XML file by checking the "Select XML configuration file" box. See Section "XML configuration files".

Once the all parameters are set in the initial dialog, click "OK". Two other dialogs for selecting color (R,G,B value, see below) and line style open. You may select the defaults by pressing "Enter". A window opens with the data plotted. By default the program checks for data file updates about every 1 second. This can be changed by clicking Timer->Set and typing a different number of 1/10 second in the dialog box. For example, typing 1 in the dialog box will set the timer interval to 1/10 second. Setting the update interval to 0 stops checking for file updates. It is also possible to stop checking for updates by right-clicking anywhere on the plot window area and choosing "Freeze" from the floating pop-up menu. Selecting "Unfreeze" in this menu will re-enable data updates. Selecting "Update" forces an immediate data update no matter what the value of timer interval is.

Depending on the program which writes the data and the OS, there is a slight chance that RtPlot will try to read its data while the other program writes the data file. If that happens, increase the timer interval. If you are in control of the source code of the program that writes the data, you can add a file lock (e.g. by using the FileLock API) to the program. RtPlot would then wait for the OS to complete the writing of data.

For very large data files on slower computers, parsing the input may take too much CPU time. If that happens, increase the time interval.

The x, y ranges can be adjusted either by clicking Plot->Range->x-range (or y-range) in the main menu or "Modify" in the floating pop-up menu. To enable/disable auto x-scrolling, check/uncheck the "Auto X scroll" in the pop-up menu. Adjusting the number of x & y "ticks" is similar. Selecting "Line" in the pop-up menu opens sub menu from which it is possible to change color (default black), width (default 1) and style (default solid) of the line. The color is expressed in R-G-B (Re, Green, Blue) units. Each of R, G, B can be any number between 0,255. RGB=(0,0,0) is a black line, RGB=(255,0,0) is a red line, RGB = (0,255,0) is a green line and RGB=(0,0,255) is a blue line. If there are more than a single curve in the window a list of all curves is displayed and the user can select the appropriate curve.

By default, no data points are display. To add data points change their size by selecting in the floating pop-up menu line->points and choosing the point size for a value larger than 0. Selecting 0 eliminates the data points.

By default, RtPlot adds grid lines to its windows. To disable, click Plot in the menu and uncheck "Grid".

To add a curve to a window, click plot->Add File from the menu bar. The Add file dialog will open. To delete a curve use plot->Remove File. A dialog box will open with a list of curves in the window. Select the curve to delete. For each curve, its file name and the x-y columns it displays are listed.

Listed in the title bar of the plot window are (1) Time of most recent data update, (2) data file names, and (3) the data columns. The time of starting RtPlot appears in the application title bar.

It is possible to open any number of plot windows by clicking File->New in the main menu.

History- It is possible to display in a window several recent updates to a data file. Use Plot->History and select the history size for the appropriate curve. Recent updates will be displayed in fading shades.

Dragging- A useful feature is the ability to drag the plotted data in the plot window and to examine various portions of the plot. This is done by clicking the left mouse button and dragging the mouse while the button is pressed.

BMP/PNG files:

RtPlot is able to save the contents of any plot window in 4-bit (16 colors) bitmap (BMP) or PNG (Portable Network Graphics) formats. The choice of 4-bits is to save disk space, but this may be configurable in future versions. There are two ways to save a file in a graphic format:
  1. From the file menu select "Save as.." to open the Windows Save dialog box and select BMP or PNG formats and the file name.
  2. Save the contents of a window to a graphic file whenever the window is updated. This is useful for displaying plots on a web page using the REFRESH HTML meta-tag. To activate this feature select Saving->Start from the main menu. To stop saving select Saving->Stop. There is a minimum of 1 minute between savings. To set the file name and the minimum interval between saving, select Saving->Setting... . By default the format is PNG and the file name is rtplot0.png for the first window, rtplot1.png for the second and so on. You can switch formats by selecting the appropriate radio button. Pressing OK in this menu activates the saving feature.

If you need your plot in GIF format, you may use other tools such as the free command- line utility bmp2gif (downloadable from Simtel) to generate a GIF file from BMP.

Auto x-scroll

Normally, the x-axis interval [xmin,xmax] displayed in a window is set by the user in in dialogs or menus. However, when data points are added periodically to a file, it may be useful to adjust the interval automatically when the last point falls out of the current [xmin, xmax]. This can be done by activating auto x-scrolling.

Auto x-scrolling can be activated in several ways:

X-scrollbar

Scrollbar along the x-axis can activated/deactivated by clicking on the x-scrollbar in the context menu. When activated, a scrollbar appears along the x-axis if all data can not fit into the current view. When new data is added, the size of the scrollbar is automatically adjusted.

When enabling the x-scrollbar, the Auto x-scroll is disabled, so that it does not interfere with viewing backward data. When disabling the x-scrollbar, Auto-x-scroll is re-enabled if it was in effect when the x-scrollbar was enabled. Otherwise, the new view is approximately the same as the last view with the x-scrollbar.

Printing

To print the contents of a window, select File->Print.... A dialog box will open. You may enter a title line and up to two comment lines. These will be printed as the header. To include date/time information, check the box at the bottom of the dialog (Enabled by default). This will add date/time information as a footer. The usual Window's print dialog will follow.

XML configuration files:

The configuration of a plot may be saved in a XML file. To save a configuration, click File->Save Configuration. A "Save As" dialog will open.

To load a plot using an existing configuration file click File and in the "New Plot Information" dialog check the "use XML configuration file" box. A File dialog will open.

Alternatively, a plot defined by a XML configuration file can be loaded on startup using the command line option -x.

The configuration files may be edited using a text editor. RtPlot is somewhat sensitive to the correctness of the XML file. This will probably be improved in a future version. The best way to produce a configuration file is by using the File->Save configuration from the menu, and then edit it if necessary.

Most tags in a configuration file have either self-explanatory names or the same name as in RtPlot menus. The tag line_color has three comma separated values corresponding to RGB values of the color of curves. The line_style tag accepts the values SOLID, DASH, DOT, DASHDOT and DASHDOTDOT. Numbers appended to tag names correspond to the various curves in the window.

Data Format:

RtPlot expects the data in the file is ordered in two (or more) columns. E.g.

#This is a comment
0.0 1.0
1.0 2.0
2.0 3.0

Lines beginning with # are considered as comments. The numbers can be integers
or floating point number in either fixed or scientific format. 

Command line

RtPlot understands the following command line options:
-n
Opens the New Plot dialog upon startup

-x f1.xml f2.xml ... fn.xml
Opens the XML configuration files f1.xml, f2.xml,...,fn.xml upon startup

  
-p filename xcol ycol xmin xmax ymin ymax
Opens directly a plot window rather then typing them in the New Plot dialog. Parameters following -p have the same meaning as in the New Plot dialog.
Examples:
rtplot -n -x testplot1.xml testplot2.xml
Starts RtPlot with two plot windows corresponding to the configuarion files testplot1.xml and testplot2.xml. In addition, the New Plot dialog opens so that a third plot window can be added.

rtplot -p testplot1.txt 0 1 0.0 6.28 -1.0 1.0 -x testplot2.xml
Starts RtPlot with two plot windows. The first window displays the first two columns (xcol=0, ycol=1) of the data file testplot1.txt. The interval of the x-axis is [0.0,6.28] and of the y-axis [-1,1]. The second window displays the plot defined in the configuration file testplot2.xml

Demonstration

The package contains a small executable, plottest.exe. The source code for the executable, "testplot.cpp", is provided as well. Running the executable will produce a data file "testplot.txt". The file will be updated every seconds with curves of sin & cosine. A new data line is added at each update, until x=20. Then, it will restart from x = 0. The configuration file, "testplot.xml", is set with the auto_x_scroll tag enabled.

To start the demo type the following two lines in a console window:


start /LOW /B plottest.exe
rtplot -x testplot.xml

Note: Windows 95/98/ME does not accept the /LOW /B parameters to start. On these systems just omit these parameters in the first line.

A maximized plot window is opend with two curves (red & green) being updated every second. To stop the updates right-click anywhere in the plot window area and select freeze from the popup menu. Selecting later unfreeze will restart the motion of the plots.

Note to Windows 95 users

This version uses MFC7.0. It may require the file OLEACC.DLL which does not exist on all Win95 systems. You may install it by downloading a kit from Microsoft or search Google for other solutions.

Copyright Notice

RtPlot version 0.55, Copyright(c) 1999-2003 Dov Bai

Permission to use, copy, and distribute this software and its documentation for any purpose (except as detailed hereunder) is granted without fee, provided that the above copyright notice and this permission notice appear in all copies of the software and related documentation. You may not disassemble, decompose, reverse engineer, or alter any of the files in the package.

This software cannot be sold or bundled with any commercial package without express written permission from Dov Bai, its author.

THIS IS FREEWARE. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND. THERE IS NO LIABILITY FOR ANY DAMAGES OF ANY KIND ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Author

Please direct questions, suggestions or bug reports to the author:
Dov Bai
e.-mail: dbai@juno.com.

For more information on RtPlot, troubleshooting or downloading previous versions, try here.