Colormaps

These are the methods for creating and using colormaps and color spaces in PDF graphics.

FigureMaker methods

convert_to_colormap(red, green, blue)  [ doc ]

Return a colormap corresponding to the given vectors of
intensities.  The intensities must be numbers between 0 and 1,
and the vectors must be of equal lengths.

create_colormap(points, red=None, green=None, blue=None, hue=None, lightness=None, saturation=None, length=256)  [ doc ]

Return a color map

INPUTS

  points -- vector of increasing locations starting at 0.0
            and ending at 1.0
  red    -- vector of red intensities (between 0.0 and 1.0)
  green  -- vector of green intensities (between 0.0 and 1.0)
  blue   -- vector of blue intensities (between 0.0 and 1.0)
  hue    -- vector of hue angles in degrees (between 0 and 360)
  lightness
         -- vector of lightness (between 0.0 and 1.0)
  saturation
         -- vector of saturation (between 0.0 and 1.0)
  length -- integer between 2 and 256; defaults to 256

The `length` parameter determines the number of entries in the
map and must be an integer between 2 and 256.  The `points`
vector gives positions between 0.0 and 1.0 where the colors
are explicitly specified for the map.  The first color map
entry corresponds to position 0.0, the last map entry is for
position 1.0, and intermediate map entries are spaced evenly
in between.  The color specifications are given either as RGB
triples (in the vectors `red`, `green`, and `blue`) or as HLS
triples (in the vectors `hue`, `lightness`, and `saturation`).
In either case, there must be the same number of triples as
there are positions in the 'points' vector.  The color
position points[i] is assigned the color from the
corresponding red[i], green[i], and blue[i] for the RGB case.
In the HLS case, the triple hue[i], lightness[i], and
saturation[i] is converted to a triple of RGB intensities, and
that is assigned to the color position given by points[i].
Color map entries for other positions are determined by linear
interpolation from the neighboring assigned colors.

See also the prebuilt colormaps: `intense_colormap()`,
`mellow_colormap()`, and `rainbow_colormap()`.

create_gradient_colormap(hue=0.0, lightness=0.5, saturation=0.5)  [ doc ]

Return a color map for a gradient of HLS colors

INPUTS

  hue     -- a float or a tuple of (H_start, H_end); defaults to 0.0
  lightness
          -- a float or a tuple of (L_start, L_end); defaults to 0.5
  saturation
          -- a float or a tuple of (S_start, S_end); defaults to 0.5

The `hue` is either fixed if a float is given or varies
linearly from H_start to H_end if a tuple is given.  The
`lightness` and `saturation` are treated similarly.

get_color_from_colormap(colormap, color_position)  [ doc ]

Return the triple [red, green, blue] for the intensities of
the color at the given `color_position` in `colormap`.  Recall
that a color position is a number between 0 and 1.  See
`create_colormap()`.

hls_to_rgb(hls_vec)  [ doc ]

Return a vector of [red, green, blue] intensities
corresponding to the `hls_vec` color given as [hue, lightness,
saturation].  See also `rgb_to_hls()`.

intense_colormap()  [ doc ]

Return a colormap with fully saturated reds and blues

mellow_colormap()  [ doc ]

Return a colormap with reds and blues in which the saturation
drops for high and low color positions

rainbow_colormap()  [ doc ]

Return a colormap covering the spectrum from red, orange,
yellow, green, blue, indigo, to violet (special thanks to Roy
G. Biv for providing this)

rgb_to_hls(rgb_vec)  [ doc ]

Returns a vector of [hue, lightness, saturation] corresponding
to the `rgb_vec` color given as [red, green, blue]
intensities.  See also `hls_to_rgb()`.

FigureMaker attributes

PyTioga version: alpha (20071021)

Copyright (C) 2007 Taro Sato & Bill Paxton. All rights reserved.