making web-based graphs


Welcome     Gallery     Handbook


Manual page for making_web-based_graphs(PL)

DESCRIPTION

This page contains notes related to use of ploticus to produce data displays that are viewable on web pages.

WEB-BASED GRAPHS

For a sampler of web sites using ploticus, click here.

Ploticus can produce both PNG and run-length-compressed GIF images, both of which can be used on web pages and web servers. It can also import PNG files.

PNG is a newer image format that has superior compression (hence the images are smaller and faster to transmit). The images can be viewed using the newer versions of web browsers (Netscape 4.04 or higher, Explorer 4.0 or higher) and image viewing tools such as xv. To see if your current web browser can display PNG, try this page. See also the PNG home page

GIF format has been around for a long while, is fairly universal, and can be viewed on any graphical web browser or image viewing tool. Ploticus does not read GIF files. Ploticus writes run-length-encoded (RLE) GIF files. Our understanding is that these RLE GIF files do not use patented LZW compression. The RLE GIF images that ploticus produces are viewable via any graphical web browser or image viewer that supports GIF.

More on GIF LZW patent and licensing issues

CREATING PNG

To create a PNG image, use pl or pltab with the -png option. If your ploticus script file is named with a .p, .pl, .pls, .htm or .html ending, the PNG result will use the name of your script file, with a .png ending. Otherwise, the name out.png will be used.

To incorporate a PNG image into an HTML web page, use the HTML construct: <img src="mygraph.png">

CREATING GIF

To create GIF, use pl or pltab with the -gif option. If your ploticus script file is named with a .p, .pl, .pls, .htm or .html ending, the GIF result will use the name of your script file, with a .gif ending. Otherwise, the name out.gif will be used.

To incorporate a GIF image into an HTML web page, use the HTML construct: <img src="mygraph.gif">

TRANSPARENT BACKGROUND

Images may be created with 'transparent' background by setting the background color to transparent. This allows the ploticus graphs to be "overlayed" against the existing background color of the web page.

WEB PAGE EXAMPLE

Here is an example HTML page that is viewable using any web browser:

<html>
<center>
Here is an image.
<img src="lineplot1.gif">
</html>

Suppose the above is in a file called /home/steve/firsttry.html. If you don't have a web server running, you can view the file by entering the following URL into your web browser: file:///home/steve/firsttry.html
This assumes that your web browser is running on the same computer that the HTML file is located upon.

CGI CONTROL

The way I use ploticus via CGI is to 1) generate a unique temp file name; 2) invoke ploticus via shell or system() and build a PNG or GIF file using the unique name; 3) reference that file in an <IMG> tag; 4) clean up temp PNG / GIF files regularly using a find command run by cron. In my applications I use a static ploticus script with several @variables that I pass to it; it would also be possible to dynamically build a ploticus script (as step 1a above).

A perl script which implements a web interface to ploticus was contributed by Tom McClure. See also Controlling Ploticus from Other Programs .

IMAGE IMPORT

Ploticus includes the capability to import PNG images into graphs, and can use small images as scatterplot points and symbols. GIF import is not supported. Ploticus can also be used to reduce, enlarge, and crop images; see the gallery example pngresize

THUMBNAIL AND BUTTON IMAGES

Thumbnail images (tiny renditions of a plot for icon or selection uses) may be rendered using the -scale command line option. For example: -scale 0.15. Very small text is rendered as lines.

Ploticus can also be used to make simple buttons for web pages. See the gallery example button

Example HTML code for making a thumbnail or button that will take a user to a new page when clicked upon:

<a href="newpage.html"><img src="mybutton.gif"></a>



data display engine  
Copyright Steve Grubb


Markup created by unroff 1.0,    June 18, 2001.