functions in cmap.i -
cb_choices
|
cb_choices, n, what or cb_choices, name list available ColorBrewer color map choices with N colors. The WHAT argument is "sequential", "diverging", or "qualitative", which can be abbreviated to any smaller number of characters. The N and WHAT arguments are both optional, and may occur in either order. Called as a function, cb_choices returns a list of palette names; if the N argument is specified, "_N" will be appended to the returned names. In the second form, prints (or displays) a list of the different numbers of colors available for color map NAME. |
cmap
|
cmap, p, n or rgb = cmap(p, n) returns a list of colors 0xrrggbb corresponding to the colormap defined by parameters P. The N argument is optional; it is the the number of colors you want in the palette. N defaults to the number of colors in the palette for the current window (usually 200). If you specify N<0, that many colors will be appended to the existing palette, enabling you to stack multiple shortened palettes. Called as a subroutine, actually sets the palette; called as a function, returns [r,g,b] as Nx3 char array. Recommendations: Read http://www.sandia.gov/~kmorel/documents/ColorMaps/ Most color maps here are rather poor choices. Some reasonably good ones are: "gray", "coolwarm", "bone", "copper", and most of the ColorBrewer maps, such as "Blues" or "PuOr". The function cmap_test makes a picture you can use to test palettes. Keywords: hist=1 if P is a simple list of colors, creates a stepped palette instead of interpolating between colors hist=2 like hist=1, but the first and last colors get only a single map index instead of a full width step rev=1 reverses order of the colors (also "_r" when P is name) hsv=1 interpret P values as hue, saturation, value, not rgb hsl=1 interpret P values as hue, saturation, lightness, not rgb gamma= adjust the value (after transforming to HSV) by V^gamma gamma=1 does nothing, gamma>1 darkens the colors, and gamma<1 brightens the colors lgamma= adjust the lightness (after transforming to HSL) by L^gamma gamma=1 does nothing, gamma>1 darkens the colors, and gamma<1 lightens the colors usehue=1 if P is a simple list of colors, interpolates in hsv instead of rgb, sometimes a nicer option (try with "accent") Specifiy the rev=, gamma=, or lgamma= keywords with no other parameters to adjust the existing palette. In the case of gamma corrections, cmap remembers the initial rgb values, so that you can accurately apply multiple gamma corrections interactively. The total gamma is kept in the external variable _cm_gamma (the product of all the applied gammas). Hence, a sequence of cmap,gamma=.8 commands (say) can be used to brighten the colors preogressively, and a sequence of cmap,gamma=1.25 commands will darken it. P can be: name a scalar string naming a named palette append "_r" to name to reverse it, "_N" to name, where N is a number, to select a map of that name with the specified number of colors and select hist=N [rgb1, rgb2, ...] a list of equally spaced colors as 0xrrggbb; all three components will be linearly interpolated between these given colors [[x1,rgb1], [x2,rgb2], ..., [xN,rgbN]] a list of unequally spaced colors as 0xrrggbb; all three components will be linearly interpolated between these given colors, The x values are linearly scaled so that x1 is mapped to the first returned color and xN is mapped to the last returned color. [[r1,g1,b1], [r2,g2,b2], ...] equally spaced colors as rgb triples, range 0.0 to 1.0 if real, 0 to 255 if integers [[x1,r1,g1,b1], [x2,r2,g2,b2], ...] unequally spaced colors as rgb triples, range 0.0 to 1.0 if real, 0 to 255 if integers [&[[xr1,r1], [xr2,r2], ...], &[[xg1,g1], [xg2,g2], ...], &[[xb1,b1], [xb2,b2], ...]] a list of unequally spaced color components rN, gN, bN, which are in the range from 0.0 to 1.0 inclusive (mapped to 0 and 255 as char color component values for the returned palette). Again, the xrN, xgN, and xbN values are linearly scaled so that the first color in the returned list gets the first value in the list and the last color gets the last value. Matplotlib calls this a "linearly segmented color map". [[rindex, gindex, bindex]] gnuplot function indices for each component, 0 to 36 inclusive trailing 1-length dimension distinguishes from [rgb1, rgb2, ...]. [[[p1, p2, p3, p4]]] cmap_nonlin function parameterizing a few power laws and trig functions: p1*sin((p2*x+p3)*pi) + p4 but abs(p1*sin((p2*x+p3)*pi) + p4) if p1<0 and p2<0 p1*x^p3 + p4 if p2==0 [r, g, b] sets palette directly, ignoring n parameter unless hist=1, but accepting hsv=, hsl=, and rev= keywords. (r, g, b must have more than 4 colors, but no more than 240.) save(p=params,hist=hist,...) an object containing cmap parameters and keywords permits any input to cmap (except n) to be return value of another function Available named color maps are the yorick palette names (less ".gp"), the ColorBrewer color maps (help, cb_choices), Matplotlib (python) color maps, and GMT (Generic Mapping Tools) color maps. Some of the names conflict; you can use the functions gistct, mplct, and gmtct to break any conflicts (the ColorBrewer names are all unique). Also featured are several of the diverging color maps devised by Kenneth Moreland. See help,mshct for more on those. The Gnuplot and IDL programs use a scheme of indexed palettes; the functions gplct and idlct allow you to set those palettes. Some of the Gnuplot palettes are named Matplotlib palettes, including all the ones mentioned in the Gnuplot user manual. The cubehelix function lets you set palettes by parameters; you can get the default parameters with cmap, "cubehelix". | |
SEE ALSO: |
mshct,
gplct,
mplct,
gmtct,
gistct,
idlct,
cubehelix, cb_choices, cmap_rd, cmap_test |
cmap_rd
|
rgb = cmap_rd(filename, hsv) or cmap_rd, filename Read a color map from file FILENAME. Called as a subroutine, passes the map to cmap to install it as the current palette. Accepts yorick (gist) .gp format or GMT .cpt format. The HSV argument is an output, non-nil if and only if this is to be interpreted in HSV color space. | |
SEE ALSO: | cmap |
cmap_test
|
cmap_test Create a picture to help test color maps for artifacts and common misfeatures. After calling this, call cmap or one of the *ct functions to change the color map. | |
SEE ALSO: |
cmap,
mshct,
mplct,
gplct,
gmtct,
idlct,
cb_choices |
cubehelix
|
cubehelix, n or cubehelix(n) Set cubehelix palette, designed by D.A. Green, adapted from matplotlib. Optional argument N is number of colors in palette, defaults to 200. If called as function, returns [r,g,b] without setting palette. Optional keyword arguments: Keyword Description gamma gamma factor to emphasise either low intensity values (gamma < 1), or high intensity values (gamma > 1); defaults to 1.0. s the start color; defaults to 0.5 (i.e. purple). r the number of r,g,b rotations in color that are made from the start to the end of the color scheme; defaults to -1.5 (i.e. -> B -> G -> R -> B). h the hue parameter which controls how saturated the colors are. If this parameter is zero then the color scheme is purely a greyscale; defaults to 1.0. |
gistct
|
cm = gistct(name) or gistct, name return color map (ct = "color table") specification for yorick map NAME (where NAME.gp is the name of the palette file). You may append "_r" to the name to reverse the colors. Called as a subroutine, sets the current palette. | |
SEE ALSO: | cmap, mplct, gplct, gmtct, idlct |
gmtct
|
cm = gmtct(name) or gmtct, name return color map (ct = "color table") specification for GMT map NAME. You may append "_r" to the name to reverse the colors. Called as a subroutine, sets the current palette. Note that the cmap_rd function can read GMT color map files. | |
SEE ALSO: | cmap, mplct, gplct, gistct, cmap_rd |
gplct
|
cm = gplct(r, g, b) or gplct, r, g, b return color map (ct = "color table") specification for gnuplot function indices (R,G,B), suitable to pass to cmap. This is equivalent to: cm = [[r, g, b]] Each of R, G, B must be between 0 and 36 inclusive. A negative number reverses the sense of the function. Called as a subroutine, sets the current palette. | |
SEE ALSO: | cmap, gmtct, mplct, gistct, idlct |
idlct
|
idlct, n or idlct, tables set palette to IDL color table N. You must first call the function with the TABLES returned by idlct_rd. A second parameter is interpreted as the number of colors to use; the default is the size of the current palette or 200 if there is none. Hint: You can set _idlctables to a string containing the name of a file readable by idlct_rd to automatically load the tables the first time idlct is called. | |
SEE ALSO: | idlct_rd, cmap |
idlct_rd
|
tables = idlct_rd(filename, names) read an IDL color table file, returning TABLES and NAMES. TABLES is a 256-by-3-by-N array of N [r,g,b] color mappings, and NAMES is a corresponding list of N descriptions. The first index of tables corresponds to color index values 0:255. The default IDL color tables file is colors1.tbl in the resource/colors subdirectory of the IDL distribution. Copies and modified copies can be found on the Web, for example: http://www.bnl.gov/x26a/download/colors1.zip The IDLVM virtual machine is available without charge and includes this file. This function will also read the png files posted at http://docs.idldev.com/vis/color/default-colors.png (see http://docs.idldev.com/vis/color/vis_loadct.html) (Assumes you have the yorick-z package installed.) | |
SEE ALSO: | idlct |
mplct
|
cm = mplct(name) or mplct, name return color map (ct = "color table") specification for Matplotlib map NAME. You may append "_r" to the name to reverse the colors. Called as a subroutine, sets the current palette. | |
SEE ALSO: | cmap, mshct, gmtct, gplct, gistct, idlct |
mshct
|
cm = mshct(name) or cm = mshct(rgb1, rgb2) or mshct, name or mshct, rgb1, rgb2 return diverging color map going from RGB1 to RGB2 through white. If either color is too close to white, produces a sequential map between the two. If one of RGB1 or RGB2 is nil, it is taken to be white. If the two colors are too close in hue, also just produces a sequential map. The algorithm is from Kenneth Moreland, http://www.sandia.gov/~kmorel/documents/ColorMaps/ and references therein. A few reasonable RGB1 and RGB2 values have been given names. The name "coolwarm" produces Moreland's recommended color table. Called as a subroutine, sets the current palette. | |
SEE ALSO: | cmap, mshct, gmtct, gplct, gistct, idlct |