コード例 #1
0
ファイル: cm.py プロジェクト: jtomase/matplotlib
def get_cmap(name=None, lut=None):
    """
    Get a colormap instance, defaulting to rc values if name is None
    """
    if name is None: name = rcParams['image.cmap']
    if lut is None: lut = rcParams['image.lut']

    assert (name in datad.keys())
    return colors.LinearSegmentedColormap(name, datad[name], lut)
コード例 #2
0
ファイル: cm.py プロジェクト: jtomase/matplotlib
def Grayscale(N=LUTSIZE):
    verbose.report_error("Grayscale deprecated, please use cm.gray instead")
    return colors.LinearSegmentedColormap('gray', _gray_data, N)
コード例 #3
0
ファイル: cm.py プロジェクト: jtomase/matplotlib
def ColormapJet(N=LUTSIZE):
    verbose.report_error("ColormapJet deprecated, please use cm.jet instead")
    return colors.LinearSegmentedColormap('jet', _jet_data, N)
コード例 #4
0
ファイル: cm.py プロジェクト: jtomase/matplotlib
    'blue': ((0., 1., 1.), (1.0, 0.0, 0.0))
}

_summer_data = {
    'red': ((0., 0., 0.), (1.0, 1.0, 1.0)),
    'green': ((0., 0.5, 0.5), (1.0, 1.0, 1.0)),
    'blue': ((0., 0.4, 0.4), (1.0, 0.4, 0.4))
}

_winter_data = {
    'red': ((0., 0., 0.), (1.0, 0.0, 0.0)),
    'green': ((0., 0., 0.), (1.0, 1.0, 1.0)),
    'blue': ((0., 1., 1.), (1.0, 0.5, 0.5))
}

autumn = colors.LinearSegmentedColormap('autumn', _autumn_data, LUTSIZE)
bone = colors.LinearSegmentedColormap('bone  ', _bone_data, LUTSIZE)
cool = colors.LinearSegmentedColormap('cool', _cool_data, LUTSIZE)
copper = colors.LinearSegmentedColormap('copper', _copper_data, LUTSIZE)
flag = colors.LinearSegmentedColormap('flag', _flag_data, LUTSIZE)
gray = colors.LinearSegmentedColormap('gray', _gray_data, LUTSIZE)
hot = colors.LinearSegmentedColormap('hot', _hot_data, LUTSIZE)
hsv = colors.LinearSegmentedColormap('hsv', _hsv_data, LUTSIZE)
jet = colors.LinearSegmentedColormap('jet', _jet_data, LUTSIZE)
pink = colors.LinearSegmentedColormap('pink', _pink_data, LUTSIZE)
prism = colors.LinearSegmentedColormap('prism', _prism_data, LUTSIZE)
spring = colors.LinearSegmentedColormap('spring', _spring_data, LUTSIZE)
summer = colors.LinearSegmentedColormap('summer', _summer_data, LUTSIZE)
winter = colors.LinearSegmentedColormap('winter', _winter_data, LUTSIZE)

datad = {
コード例 #5
0
def Grayscale(N=LUTSIZE):
    print >> sys.stderr, "Grayscale deprecated, please use cm.jet instead"
    return colors.LinearSegmentedColormap('gray', _gray_data, N)
コード例 #6
0
def ColormapJet(N=LUTSIZE):
    print >> sys.stderr, "ColormapJet deprecated, please use cm.jet instead"
    return colors.LinearSegmentedColormap('jet', _jet_data, N)
コード例 #7
0
    'blue': ((0., 0, 0), (1., 1, 1))
}
_jet_data = {
    'red':
    ((0., 0, 0), (0.35, 0, 0), (0.66, 1, 1), (0.89, 1, 1), (1, 0.5, 0.5)),
    'green': ((0., 0, 0), (0.125, 0, 0), (0.375, 1, 1), (0.64, 1, 1),
              (0.91, 0, 0), (1, 0, 0)),
    'blue':
    ((0., 0.5, 0.5), (0.11, 1, 1), (0.34, 1, 1), (0.65, 0, 0), (1, 0, 0))
}

datad = {
    'gray': _gray_data,
    'jet': _jet_data,
}
gray = colors.LinearSegmentedColormap('gray', _gray_data, LUTSIZE)
jet = colors.LinearSegmentedColormap('jet', _jet_data, LUTSIZE)


def get_cmap(name=None, lut=None):
    """
    Get a colormap instance, defaulting to rc values if name is None
    """
    if name is None: name = rcParams['image.cmap']
    if lut is None: lut = rcParams['image.lut']

    assert (name in datad.keys())
    return colors.LinearSegmentedColormap(name, datad[name], lut)


# These are provided for backwards compat