make_mapping_array¶
-
make_mapping_array(N, data, gamma=1.0, inverse=False)[source]¶ Mostly a copy of
makeMappingArray, but allows circular hue gradations along 0-360, disables clipping of out-of-bounds channel values, and with fancier “gamma” scaling.- Parameters
N (int) – Number of points in the colormap lookup table.
data (2D array-like) – List of \((x, y_0, y_1)\) tuples specifying the channel jump (from \(y_0\) to \(y_1\)) and the \(x\) coordinate of that transition (ranges between 0 and 1). See
LinearSegmentedColormapfor details.gamma (float or list of float, optional) – To obtain channel values between coordinates \(x_i\) and \(x_{i+1}\) in rows \(i\) and \(i+1\) of
data, we use the formula:\[y = y_{1,i} + w_i^{\gamma_i}*(y_{0,i+1} - y_{1,i})\]where \(\gamma_i\) corresponds to
gammaand the weight \(w_i\) ranges from 0 to 1 between rowsiandi+1. Ifgammais float, it applies to every transition. Otherwise, its length must equaldata.shape[0]-1.inverse (bool, optional) – If
True, \(w_i^{\gamma_i}\) is replaced with \(1 - (1 - w_i)^{\gamma_i}\) – that is, whengammais greater than 1, this weights colors toward higher channel values instead of lower channel values.This is implemented in case we want to apply equal “gamma scaling” to different HSL channels in different directions. Usually, this is done to weight low data values with higher luminance and lower saturation, thereby emphasizing “extreme” data values with stronger colors.