mmfutils.plot.colors
Various tools for displaying information with color.
- class mmfutils.plot.colors.MidpointNormalize(vmin=None, vmax=None, clip=False, midpoint=0)[source]
Bases:
NormalizeColormap normalization that ensures a balanced distribution about the specified midpoint.
Use this with a diverging colormap to ensure that the midpoint lies in the middle of the colormap.
Examples
>>> norm = MidpointNormalize(midpoint=1.0) >>> norm(np.arange(4)) masked_array(data=[0.25, 0.5 , 0.75, 1. ], mask=False, fill_value=1e+20)
>>> norm = MidpointNormalize(midpoint=1.0, vmin=-3) >>> norm(np.arange(4)) masked_array(data=[0.375, 0.5 , 0.625, 0.75 ], mask=False, fill_value=1e+20)
- mmfutils.plot.colors.color_angle(theta, map='huslp', gamma=1, saturation=100.0, lightness=75.6)[source]
Return an RGB tuple of colors for each angle theta.
The colors cycle smoothly through all hues in the order of the rainbow. The default map is luminosity corrected:
- Parameters:
theta (array) – Array of angles as returned, for example, by np.angle.
map ('husl' or 'hue') –
Colour map to use.
- ’huslp’ :
a luminosity corrected coloring. All angles here have the same perceptual brightness, however only pastel colors are used.
- ’husl’ :
a luminosity corrected coloring similar to huslp but allowing for full saturation. Highly saturated colors do not appear to change uniformly though.
- other :
a custom but poor cycling through hue.