bronx.graphics.colormapping¶
Custom colormaps reading and scaling.
Functions¶
- bronx.graphics.colormapping.add_cmap(cmap, sourcefile)[source]¶
Reads and registers the given colormap in matplotlib.
- Parameters:
cmap – name of the colormap, to be registered under and used then
sourcefile – opened file-like object to read the colormap in.
- bronx.graphics.colormapping.get_norm4colorscale(scaling, max_val=None)[source]¶
Creates a matplotlib.colors.BoundaryNorm object tuned for scaled colormaps, i.e. discrete, irregular colorshades.
- Parameters:
scaling – the values determining changes of colors
max_val – an additional maximum value to replace the upper bound if this value is included between the last two upper values.
- Returns:
a tuple (norm, scaling), scaling being eventually modified according to max_val
- bronx.graphics.colormapping.read_cmap(sourcefile)[source]¶
Read and creates a custom Colormap from a set of RGB colors in a file with the following formating:
r1,g1,b1;\n r2,g2,b2;\n ...\n rn,gn,bn
each value being comprised between 0 and 255, or 0 and 1.
- Parameters:
sourcefile – opened file-like object to read colormap from.