__all__ = ['ColorBar'] # Setup of extra parameters in the matplotlic rc validate_orientation = ValidateInStrings('orientation', ['horizontal', 'vertical']) validate_ticklocation = ValidateInStrings( 'orientation', ['auto', 'left', 'right', 'bottom', 'top']) defaultParams.update({ 'colorbar.orientation': ['vertical', validate_orientation], 'colorbar.ticklocation': ['auto', validate_ticklocation], 'colorbar.length_fraction': [0.2, validate_float], 'colorbar.width_fraction': [0.02, validate_float], 'colorbar.location': ['upper right', validate_legend_loc], 'colorbar.pad': [0.2, validate_float], 'colorbar.border_pad': [0.1, validate_float], 'colorbar.sep': [5, validate_float], 'colorbar.frameon': [True, validate_bool], 'colorbar.color': ['k', validate_color], 'colorbar.box_color': ['w', validate_color], 'colorbar.box_alpha': [1.0, validate_float], }) # Recreate the validate function matplotlib.rcParams.validate = \ dict((key, converter) for key, (default, converter) in six.iteritems(defaultParams) if key not in matplotlib._all_deprecated) class ColorbarBase2(ColorbarBase):
# Setup of extra parameters in the matplotlic rc validate_scale_loc = ValidateInStrings('scale_loc', ['bottom', 'top', 'right', 'left'], ignorecase=True) validate_label_loc = ValidateInStrings('label_loc', ['bottom', 'top', 'right', 'left'], ignorecase=True) defaultParams.update({ 'scalebar.length_fraction': [0.2, validate_float], 'scalebar.height_fraction': [0.01, validate_float], 'scalebar.location': ['upper right', validate_legend_loc], 'scalebar.pad': [0.2, validate_float], 'scalebar.border_pad': [0.1, validate_float], 'scalebar.sep': [5, validate_float], 'scalebar.frameon': [True, validate_bool], 'scalebar.color': ['k', validate_color], 'scalebar.box_color': ['w', validate_color], 'scalebar.box_alpha': [1.0, validate_float], 'scalebar.scale_loc': ['bottom', validate_scale_loc], 'scalebar.label_loc': ['top', validate_label_loc], }) # Reload matplotlib to reset the default parameters #imp.reload(sys.modules['matplotlib']) SI_LENGTH = 'si-length' SI_LENGTH_RECIPROCAL = 'si-length-reciprocal' IMPERIAL_LENGTH = 'imperial-length' _DIMENSION_LOOKUP = {
__all__ = ['ColorBar'] # Setup of extra parameters in the matplotlic rc validate_orientation = ValidateInStrings('orientation', ['horizontal', 'vertical']) validate_ticklocation = ValidateInStrings('orientation', ['auto', 'left', 'right', 'bottom', 'top']) defaultParams.update( {'colorbar.orientation': ['vertical', validate_orientation], 'colorbar.ticklocation': ['auto', validate_ticklocation], 'colorbar.length_fraction': [0.2, validate_float], 'colorbar.width_fraction': [0.02, validate_float], 'colorbar.location': ['upper right', validate_legend_loc], 'colorbar.pad': [0.2, validate_float], 'colorbar.border_pad': [0.1, validate_float], 'colorbar.sep': [5, validate_float], 'colorbar.frameon': [True, validate_bool], 'colorbar.color': ['k', validate_color], 'colorbar.box_color': ['w', validate_color], 'colorbar.box_alpha': [1.0, validate_float], }) # Reload matplotlib to reset the default parameters imp.reload(sys.modules['matplotlib']) class ColorbarBase2(ColorbarBase): """ Disable some methods from the original :class:`ColorbarBase` class of matplotlib that required an :class:`Axes` object. """
def _validate_legend_loc(loc): rc = matplotlib.RcParams() rc["legend.loc"] = loc return loc defaultParams.update({ "scalebar.length_fraction": [0.2, validate_float], "scalebar.width_fraction": [0.01, validate_float], "scalebar.location": ["upper right", _validate_legend_loc], "scalebar.pad": [0.2, validate_float], "scalebar.border_pad": [0.1, validate_float], "scalebar.sep": [5, validate_float], "scalebar.frameon": [True, validate_bool], "scalebar.color": ["k", validate_color], "scalebar.box_color": ["w", validate_color], "scalebar.box_alpha": [1.0, validate_float], "scalebar.scale_loc": ["bottom", _validate_scale_loc], "scalebar.label_loc": ["top", _validate_label_loc], "scalebar.rotation": ["horizontal", _validate_rotation], }) # Recreate the validate function matplotlib.rcParams.validate = dict( (key, converter) for key, (default, converter) in defaultParams.items() if key not in matplotlib._all_deprecated) # Dimension lookup SI_LENGTH = "si-length"
# Globals and constants variables. # Setup of extra parameters in the matplotlic rc validate_scale_loc = ValidateInStrings('scale_loc', ['bottom', 'top', 'right', 'left'], ignorecase=True) validate_label_loc = ValidateInStrings('label_loc', ['bottom', 'top', 'right', 'left'], ignorecase=True) defaultParams.update( {'scalebar.length_fraction': [0.2, validate_float], 'scalebar.height_fraction': [0.01, validate_float], 'scalebar.location': ['upper right', validate_legend_loc], 'scalebar.pad': [0.2, validate_float], 'scalebar.border_pad': [0.1, validate_float], 'scalebar.sep': [5, validate_float], 'scalebar.frameon': [True, validate_bool], 'scalebar.color': ['k', validate_color], 'scalebar.box_color': ['w', validate_color], 'scalebar.box_alpha': [1.0, validate_float], 'scalebar.scale_loc': ['bottom', validate_scale_loc], 'scalebar.label_loc': ['top', validate_label_loc], }) # Reload matplotlib to reset the default parameters #imp.reload(sys.modules['matplotlib']) SI_LENGTH = 'si-length' SI_LENGTH_RECIPROCAL = 'si-length-reciprocal' IMPERIAL_LENGTH = 'imperial-length' _DIMENSION_LOOKUP = {SI_LENGTH: SILengthDimension,