Python matplotlib.cm.autumn() Examples

The following are code examples for showing how to use matplotlib.cm.autumn(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: LaserTOF   Author: kyleuckert   File: pyplot.py    MIT License 5 votes vote down vote up
def autumn():
    '''
    set the default colormap to autumn and apply to current image if any.
    See help(colormaps) for more information
    '''
    rc('image', cmap='autumn')
    im = gci()

    if im is not None:
        im.set_cmap(cm.autumn)


# This function was autogenerated by boilerplate.py.  Do not edit as
# changes will be lost 
Example 2
Project: Computable   Author: ktraunmueller   File: pyplot.py    MIT License 5 votes vote down vote up
def autumn():
    '''
    set the default colormap to autumn and apply to current image if any.
    See help(colormaps) for more information
    '''
    rc('image', cmap='autumn')
    im = gci()

    if im is not None:
        im.set_cmap(cm.autumn)
    draw_if_interactive()


# This function was autogenerated by boilerplate.py.  Do not edit as
# changes will be lost 
Example 3
Project: neural-network-animation   Author: miloharper   File: pyplot.py    MIT License 5 votes vote down vote up
def autumn():
    '''
    set the default colormap to autumn and apply to current image if any.
    See help(colormaps) for more information
    '''
    rc('image', cmap='autumn')
    im = gci()

    if im is not None:
        im.set_cmap(cm.autumn)
    draw_if_interactive()


# This function was autogenerated by boilerplate.py.  Do not edit as
# changes will be lost 
Example 4
Project: Blackjack-Tracker   Author: martinabeleda   File: pyplot.py    MIT License 5 votes vote down vote up
def autumn():
    '''
    set the default colormap to autumn and apply to current image if any.
    See help(colormaps) for more information
    '''
    rc('image', cmap='autumn')
    im = gci()

    if im is not None:
        im.set_cmap(cm.autumn)


# This function was autogenerated by boilerplate.py.  Do not edit as
# changes will be lost 
Example 5
Project: cnidaria   Author: sauloal   File: pyplot.py    MIT License 5 votes vote down vote up
def autumn():
    '''
    set the default colormap to autumn and apply to current image if any.
    See help(colormaps) for more information
    '''
    rc('image', cmap='autumn')
    im = gci()

    if im is not None:
        im.set_cmap(cm.autumn)
    draw_if_interactive()


# This function was autogenerated by boilerplate.py.  Do not edit as
# changes will be lost 
Example 6
Project: SpineFinder   Author: jfm15   File: measure.py    GNU General Public License v3.0 4 votes vote down vote up
def compete_detection_picture(scans_dir, models_dir, plot_path, spacing=(2.0, 2.0, 2.0)):

    scan_paths = glob.glob(scans_dir + "/**/*.nii.gz", recursive=True)
    model_paths = glob.glob(models_dir + "/*.h5", recursive=True)
    no_of_scan_paths = len(scan_paths)
    no_of_model_paths = len(model_paths)
    print("rows", no_of_model_paths, "cols", no_of_scan_paths)

    weights = np.array([0.1, 0.9])
    model_objects = {'loss': weighted_categorical_crossentropy(weights),
                     'binary_recall': km.binary_recall(),
                     'dice_coef': dice_coef_label(label=1)}

    fig, axes = plt.subplots(nrows=no_of_model_paths, ncols=no_of_scan_paths, figsize=(20, 10), dpi=300)

    i = 1

    for col, scan_path in enumerate(scan_paths):

        scan_path_without_ext = scan_path[:-len(".nii.gz")]
        centroid_path = scan_path_without_ext + ".lml"

        _, centroids = opening_files.extract_centroid_info_from_lml(centroid_path)

        scan_name = (scan_path.rsplit('/', 1)[-1])[:-len(".nii.gz")]
        axes[0, col].set_title(scan_name, fontsize=10, pad=10)

        for row, model_path in enumerate(model_paths):
            print(i)

            size = np.array([30, 30, 36])
            current_spacing = spacing
            if model_path == "saved_current_models/detec-15:59.h5" \
                    or model_path == "saved_current_models/detec-15:59-20e.h5" :
                print("here")
                size = np.array([64, 64, 80])
                current_spacing = (1.0, 1.0, 1.0)

            centroid_indexes = centroids / np.array(current_spacing)
            cut = np.round(np.mean(centroid_indexes[:, 0])).astype(int)

            model_name = (model_path.rsplit('/', 1)[-1])[:-len(".h5")]
            axes[row, 0].set_ylabel(model_name, rotation=0, labelpad=50, fontsize=10)

            volume = opening_files.read_nii(scan_path, spacing=current_spacing)
            detection_model = load_model(model_path, custom_objects=model_objects)

            detections = apply_detection_model(volume, detection_model, size)

            volume_slice = volume[cut, :, :]
            detections_slice = detections[cut, :, :]

            masked_data = np.ma.masked_where(detections_slice == 0, detections_slice)

            axes[row, col].imshow(volume_slice.T, cmap='gray')
            axes[row, col].imshow(masked_data.T, cmap=cm.autumn, alpha=0.4)

            i += 1

    fig.subplots_adjust(wspace=-0.2, hspace=0.4)
    fig.savefig(plot_path + '/detection-complete.png') 
Example 7
Project: SWEETer-Cat   Author: DanielAndreasen   File: plot.py    MIT License 4 votes vote down vote up
def detail_plot(df, tlow, thigh):

    hz1 = get_default(df['hz1'].values[0], -2, float)
    hz2 = get_default(df['hz2'].values[0], -1, float)
    color = get_default(df['teff'].values[0], 5777, float)
    tlow = get_default(max(2500, tlow), 2500, int)
    thigh = get_default(min(8500, thigh), 8500, int)

    R = df.iloc[0]['radius']
    r = [planetary_radius(mi, ri) for mi, ri in df.loc[:, ['plMass', 'plRadius']].values]
    smas = df['sma'].values
    max_smas = max([smai for smai in smas if isinstance(smai, (int, float)) and not np.isnan(smai)])
    Rs = max(500, 500*R)
    rs = [max(80, 30*ri) for ri in r]

    fig, ax = plt.subplots(1, figsize=(14, 2))
    ax.scatter([0], [1], s=Rs, c=[color], vmin=tlow, vmax=thigh, cmap=cm.autumn)
    no_sma = []

    if 0 < hz1 < hz2:
        x = np.linspace(hz1, hz2, 10)
        y = np.linspace(0.9, 1.1, 10)
        z = np.array([[xi]*10 for xi in x[::-1]]).T
        plt.contourf(x, y, z, 300, alpha=0.8, cmap=cm.summer)

    for i, sma in enumerate(smas):
        if np.isnan(sma):
            no_sma.append('{} has no SMA'.format(df['plName'].values[i]))
            continue
        if sma < hz1:
            dist = hz1-sma
            ax.scatter(sma, [1], s=rs[i], c=[dist], vmin=0, vmax=hz1, cmap=cm.autumn)
        elif hz1 <= sma <= hz2:
            ax.scatter(sma, [1], s=rs[i], c='k', alpha=0.8)
        else:
            dist = sma-hz2
            ax.scatter(sma, [1], s=rs[i], c=[dist], vmin=hz2, vmax=max_smas, cmap=cm.winter_r)

    for planet in ss_planets.keys():
        s = ss_planets[planet][0]
        r = 30*ss_planets[planet][1]/2.
        r /= float(ss_planets['Jupiter'][1])
        ax.scatter(s, [0.95], s=r*10, c='g')
        ax.text(s-0.01, 0.97, planet, color='white')

    ax.set_xlim(0.0, max_smas*1.2)
    ax.set_ylim(0.9, 1.1)
    ax.set_xlabel('Semi-major axis [AU]')
    ax.yaxis.set_major_formatter(plt.NullFormatter())
    ax.set_yticks([])
    ax.spines['left'].set_visible(False)
    ax.set_facecolor('black')
    plt.tight_layout()

    for i, text in enumerate(no_sma):
        ax.text(max_smas*0.8, 1.05-i*0.02, text, color='white')

    return fig_to_html(fig)