Color mapping of a range of values.
Classes defined in module colorscale
Mapping floating point values into colors.
A colorscale maps floating point values within a certain range into colors and can be used to provide visual representation of numerical values. This is e.g. quite useful in Finite Element postprocessing (see the postproc plugin).
The ColorLegend class provides a way to make the ColorScale visible on the canvas.
Methods
Scale a value to the range -1...1.
If the ColorScale has only one exponent, values in the range mival..maxval are scaled to the range -1..+1.
If two exponents were specified, scaling is done independently in one of the intervals minval..midval or midval..maxval resulting into resp. the interval -1..0 or 0..1.
Return the color representing a value val.
The returned color is a tuple of three RGB values in the range 0-1. The color is obtained by first scaling the value to the -1..1 range using the ‘scale’ method, and then using that result to pick a color value from the palet. A palet specifies the three colors corresponding to the -1, 0 and 1 values.
A colorlegend is a colorscale divided in a number of subranges.
Methods
Raise a runtime error if oflow == None, else return oflow.
Return the color representing a value val.
The color is that of the subrange holding the value. If the value matches a subrange limit, the lower range color is returned. If the value falls outside the colorscale range, a runtime error is raised, unless the corresponding underflowcolor or overflowcolor attribute has been set, in which case this attirbute is returned. Though these attributes can be set to any not None value, it will usually be set to some color value, that will be used to show overflow values. The returned color is a tuple of three RGB values in the range 0-1.
Functions defined in module colorscale