next up previous contents index
Next: plsys: Set Coordinate System Up: Other Controls Previous: animate: Control Animation Mode   Contents   Index


palette: Set or Retrieve Palette

Calling Sequence
...

  
palette (filename) 
palette (source_window_number) 
palette (red, green, blue[, gray][, query = 1] 
          [, ntsc = 1/0])

Description

Set (or retrieve with query = 1) the palette for the current graphics window. The filename is the name of a Gist palette file; the standard palettes are earth.gp, stern.gp, rainbow.gp, heat.gp, gray.gp, and yarg.gp. Use the maxcolors keyword in the pldefault command to put an upper limit on the number of colors which will be read from the palette in filename.

In the second form, the palette for the current window is copied from window number source_window_number. If the X colormap for the window is private, there will still be two separate X colormaps for the two windows, but they will have the same color values.

In the third form, red, green, and blue are 1D arrays of unsigned char (Python typecode "b") and of the same length specifying the palette you wish to install; the values should vary between 0 and 255, and your palette should have no more than 240 colors. If ntsc= 0, monochrome devices (such as most laser printers) will use the average brightness to translate your colors into gray; otherwise, the NTSC (television) averaging will be used (.30*red.59*green+.11* blue+). Alternatively, you can specify gray explicitly.

Ordinarily, the palette is not dumped to a hardcopy file (color hardcopy is still rare and expensive), but you can force the palette to dump using the window() or hcp_file() commands.


next up previous contents index
Next: plsys: Set Coordinate System Up: Other Controls Previous: animate: Control Animation Mode   Contents   Index
Michiel Jan Laurens de Hoon 2003-04-19