class PlotConfig(t.HasTraits): saturated_pixels = t.CFloat(0.05, label='Saturated pixels', desc='Set the default saturated pixels value ' 'for plotting images.' ) cmap_navigator = t.Enum(list(cmap_d.keys()), label='Color map navigator', desc='Set the default color map for the navigator.', ) cmap_signal = t.Enum(list(cmap_d.keys()), label='Color map signal', desc='Set the default color map for the signal plot.', ) dims_024_increase = t.Str('right', label='Navigate right' ) dims_024_decrease = t.Str('left', label='Navigate left', ) dims_135_increase = t.Str('down', label='Navigate down', ) dims_135_decrease = t.Str('up', label='Navigate up', ) modifier_dims_01 = t.Enum(['ctrl', 'alt', 'shift', 'ctrl+alt', 'ctrl+shift', 'alt+shift', 'ctrl+alt+shift'], label='Modifier key for 1st and 2nd dimensions') # 0 elem is default modifier_dims_23 = t.Enum(['shift', 'alt', 'ctrl', 'ctrl+alt', 'ctrl+shift', 'alt+shift', 'ctrl+alt+shift'], label='Modifier key for 3rd and 4th dimensions') # 0 elem is default modifier_dims_45 = t.Enum(['alt', 'ctrl', 'shift', 'ctrl+alt', 'ctrl+shift', 'alt+shift', 'ctrl+alt+shift'], label='Modifier key for 5th and 6th dimensions') # 0 elem is default
def _handle_cmap(self, sender): # This should test colour map string is valid: and warn. from matplotlib.cm import cmap_d cmap_string = self.cmap.value if cmap_string and cmap_string in cmap_d.keys(): self.mpl_kwargs['cmap'] = cmap_string self.cmap.description = 'colour map' else: self.cmap.description = 'not a cmap'
# Create txt-file with colormap data np.savetxt("cm_{0}.txt".format(name), rgb, fmt='%.8e') # Create txt-file with 8-bit colormap data rgb_8bit = np.rint(rgb * 255) np.savetxt("{0}/{0}_8bit.txt".format(name), rgb_8bit, fmt='%i') # Load in all colormaps currently defined import_cmaps('.') # Make new colormap overview create_cmap_overview(savefig='cmap_overview.png', sort='lightness') create_cmap_overview(savefig=path.join(docs_dir, 'images', 'cmap_overview.png'), sort='lightness') create_cmap_overview(cmap_d.keys(), plot_profile=True, sort='lightness', savefig=path.join(docs_dir, 'images', 'mpl_cmaps.png')) # Make string with the docs entry docs_entry = dedent(""" .. _{0}: {0} {1} .. image:: ../../../../cmasher/colormaps/{0}/{0}.png :alt: Visual representation of the *{0}* colormap. :width: 100% :align: center