IMAge [MIN #|MAX #|OFF|CCT $|LOG|LIN|SQRT|HISTO|TOT] This command will allow you to display your data as an image.


IMAge CCT $ PLT currently has 3 built in color tables. Use


to see a list of these and a brief description. Thus if you use "CCT 1" you will get the gray scale color where the minimum value appears black and the maximum as white. To invert the color table preceed the name with a minus sign (no space). Thus "CCT -1" would give a grayscale image where the minimum is white and the max is black.

Color tables can also be defined in external ASCII files. If you have a file called "blue.ct" then you can read this with "CCT blue". Note, "CCT -blue" will invert the color table, hence you are advised not to use a minus sign as the first character in the file name.


PLT> IMA CCT 2 ! Use builtin color table 2 to display images.


A color table file is an ASCII file consisting of a series of rows each with 4 columns. The first column is the "normalized color index" which must be in the range 0 to 1 and monotonically increasing. The next 3 columns are for the red, green, and blue values and each number must be in the range 0 to 1. Thus a minimal color table would consist of just two rows. Here is some sample data from a file which we will call "blue.ct"
!CI   R    G    B
 0.   0.   0.   0.
 1.   0.   0.   1.
Using "CCT blue" will cause the minimum value to be plotted in black (no color on) and the maximum value will be plotted with the blue color full on, but red and green colors off.

How does the color table work? Suppose PGPLOT has allocated color indices 17 to 240 for images. Assume you have set the min value is 0 and the max is 100, and you are about to display a pixel value of 40. With the linear scaling PGPLOT would plot this value with a color index of 0.4*(240-17+1) = 90. The normalized color index is 40/(100-0+1) = 0.40. Since this color index two values in the file, the software will do a linear interpolation for the red, green and blue values. Using the blue.ct given above, red and green values would both be off and the blue value would be set to 40 percent of the maximum value.

The reason for using a normalized color index and an normalized color intensities is to reduce the dependence on the graphics device, i.e., you don't need to know how many color indices the device supports nor which ones PGPLOT have allocated to the image. Anyone who has worked with colors knows that "blue full on" looks different on different devices, hence you will need to fine tune the color table to look nice on the device you are plotting to.





PGPLOT draws pixels centered on the integer pixel location and extending out to +/- half a pixel. Thus if you want your image to exactly fill the plotting window, you should use

GAp 0.0 Errors R ! reset the default scale.

The GAp 0.0 ensures there is no extra gap around the data, and the Errors causes the error bars to be included when min/max values are computed. Since IMAge only works when using XAx Linear and YAx Linear this effectively includes the extra half pixel when the min/max are computed.

PLT works equally well with both "pseudo color" and "true color" devices (if you don't know what these terms mean you might want to read the history topic below). Since pseudo color can only have one lookup table active per program, using multiple color tables in different PLT windows can result in confusion when switching from a pseudo color device (such as a SUN X Window display) to a true color device (such as PostScript file). To avoid this confusion you should only use one color table for all plot windows. It is also suggested that you define this color table in the image that appears in the lowest numbered window i.e., the one that is plotted first. This ensures that the color table will be correctly loaded for all following windows.


Pseudo color devices were invented early in the age of computers where processors were slow and memory was expensive. Thus it was not practical to store a 24 bit (Red,Green,Blue) RGB color triplet for every pixel. What was (typically) done was store an 8 bit color index instead which allows only 256 color indices at each pixel. However, even early monitors could diplay more than 256 colors resulting in a missmatch between the display adapter and the monitor.

In order to give users the ability use more than 256 colors, a lookup table was implemented. For example, color index 2 could correspond to Red=255, Green=10, Blue=10 a red pixel. Thus the hardware would read the color index of a pixel, lookup corresponding color in the color lookup table and then draw the pixel on the screen. This can be done very quickly and is very memory efficient. Another advantage of using a color lookup table is it can be reloaded very quickly. For example, the IRAF image display exploits this feature by allowing the user to change the lookup table by draging the mouse around in the display window. Although this allows you to quickly find a color table that enhances the features they are interested in, it is worth noting that you are not enhancing the data, just the monitors ability to display the data. In other words, features that are visible when one lookup table is loaded, are still present (in the display memory) for all the other lookup tables tried.

At the current time, it is typical for computers to display several windows each drawn by a different program. If all these programs can agree on a color lookup table then things work fine. On the other hand if a program wants total control of a lot of colors (IDL and Netscape are famous for this) then the operating system must swap lookup tables around as the user changes from window to window, program to program. Since the lookup table can be loaded very quickly this results in entire monitor flashing from one set of colors to another.

It is no longer necessary to skimp on memory. Current machines have no problem loading 24 bit RGB indices at resolutions up to 1000 by 800 pixels (2.4 MB for display memory). In fact, since three is an odd number most displays load 32 bits per pixel, with 24 bits of RGB data and 8 bits of something else such as a "alpha overlay plane". This makes true color devices possible. What true color means, is each pixel is loaded with its true RGR color triplet, and hence there is no color lookup table.

Thus pseudo color means a color index is stored in memory and lookup table is used to map the color index into a RGB triplet. A true color device stores the RGB triplet in memory.

Many people assume X Windows pseudo color, however, X Windows can actually support either. Suns typically implement X in a pseudo color manner whereas SGIs typically implement true color. PostScript of course, is true color (i.e., no amount of messing with a color table is going to change what is printed on paper.)

Return to plt main page.