Python matplotlib.cm.hot() Examples

The following are code examples for showing how to use matplotlib.cm.hot(). 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: PixelAccurateDepthBenchmark   Author: gruberto   File: Evaluator.py    MIT License 6 votes vote down vote up
def error_image(self, sample, approach, gt_type='intermetric'):
        groundtruth = self.load_depth_groundtruth(sample.split('_')[0], frame=self.frames[approach], gt_type=gt_type)
        output = self.load_depth(sample, approach)

        error_image = np.zeros(groundtruth.shape)

        eval_pos = np.logical_and(groundtruth > 0, output > 0)
        output = output[eval_pos]
        groundtruth = groundtruth[eval_pos]
        output = np.clip(output, self.clip_min, self.clip_max)
        groundtruth = np.clip(groundtruth, self.clip_min, self.clip_max)

        error_image[eval_pos] = np.abs(output - groundtruth)

        norm = mpl.colors.Normalize(vmin=0, vmax=self.clip_max - self.clip_min)
        cmap = cm.hot
        m = cm.ScalarMappable(norm=norm, cmap=cmap)

        error_image = m.to_rgba(error_image)[:, :, 0:3]
        error_image[~eval_pos] = (0, 0, 0)

        error_image = cv2.cvtColor((255 * error_image).astype(np.uint8), cv2.COLOR_BGR2RGB)

        return error_image 
Example 2
Project: vi-suite05   Author: rgsouthall   File: viexperiments.py    GNU General Public License v2.0 6 votes vote down vote up
def retcols(scene):
    try:
        cmap = mcm.get_cmap(scene.vi_leg_col)
        hs = [0.75 - 0.75*(i/19) for i in range(20)]
        rgbas = [cmap(int(i * 256/(20 - 1))) for i in range(20)]
#        if scene.vi_leg_col == '0':
#            hs = [0.75 - 0.75*(i/19) for i in range(levels)]
#            rgbas = [(*colorsys.hsv_to_rgb(h, 1.0, 1.0), 1.0) for h in hs]
#        elif scene.vi_leg_col == '1':
#            rgbas = [(i/19, i/19, i/19, 1) for i in range(levels)]
#        elif scene.vi_leg_col == '2':
#            rgbas = [mcm.hot(int(i * 256/19)) for i in range(levels)]
#        elif scene.vi_leg_col == '3':
#            rgbas = [mcm.CMRmap(int(i * 256/19)) for i in range(levels)]
#        elif scene.vi_leg_col == '4':
#            rgbas = [mcm.jet(int(i * 256/19)) for i in range(levels)]
#        elif scene.vi_leg_col == '5':
#            rgbas = [mcm.plasma(int(i * 256/19)) for i in range(levels)]
    except:
        hs = [0.75 - 0.75*(i/19) for i in range(20)]
        rgbas = [(*colorsys.hsv_to_rgb(h, 1.0, 1.0), 1.0) for h in hs]
    return rgbas 
Example 3
Project: SamPy   Author: sniemi   File: hstdemo.py    BSD 2-Clause "Simplified" License 6 votes vote down vote up
def hstdemo():
    rc('image',origin='lower') # correct display requires setting origin to this
    hst, chandra = load_hst_data()
    # set size of figure window to be exactly that of the image so no resampling is done
    h, w, d = hst.shape
    dpi=80.
    figure(figsize=(w/dpi, h/dpi), dpi=dpi)
    # set plot region to full window size
    axes((0,0,1,1))
    # display rgb HST image
    imshow(hst)
    # overplot X-ray contour map
    contour(chandra, [.95,.85, .6], linewidths=2, cmap=cm.hot)
    clim(0,1.1)
    legend(loc='lower right')
    text(160, 75, 'HST image of NGC 1275\n with Chandra X-Ray contours',
           color='white', size=22) 
Example 4
Project: LaserTOF   Author: kyleuckert   File: pyplot.py    MIT License 5 votes vote down vote up
def sci(im):
    """
    Set the current image.  This image will be the target of colormap
    commands like :func:`~matplotlib.pyplot.jet`,
    :func:`~matplotlib.pyplot.hot` or
    :func:`~matplotlib.pyplot.clim`).  The current image is an
    attribute of the current axes.
    """
    gca()._sci(im)


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

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


# This function was autogenerated by boilerplate.py.  Do not edit as
# changes will be lost 
Example 6
Project: FX-RER-Value-Extraction   Author: tsKenneth   File: pyplot.py    MIT License 5 votes vote down vote up
def hot():
    """
    Set the colormap to "hot".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    """
    set_cmap("hot")


# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example 7
Project: ble5-nrf52-mac   Author: tomasero   File: pyplot.py    MIT License 5 votes vote down vote up
def hot():
    """
    Set the colormap to "hot".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    """
    set_cmap("hot")


# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example 8
Project: Computable   Author: ktraunmueller   File: pyplot.py    MIT License 5 votes vote down vote up
def sci(im):
    """
    Set the current image.  This image will be the target of colormap
    commands like :func:`~matplotlib.pyplot.jet`,
    :func:`~matplotlib.pyplot.hot` or
    :func:`~matplotlib.pyplot.clim`).  The current image is an
    attribute of the current axes.
    """
    gca()._sci(im)


## Any Artist ##
# (getp is simply imported) 
Example 9
Project: Computable   Author: ktraunmueller   File: pyplot.py    MIT License 5 votes vote down vote up
def hot():
    '''
    set the default colormap to hot and apply to current image if any.
    See help(colormaps) for more information
    '''
    rc('image', cmap='hot')
    im = gci()

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


# This function was autogenerated by boilerplate.py.  Do not edit as
# changes will be lost 
Example 10
Project: neural-network-animation   Author: miloharper   File: pyplot.py    MIT License 5 votes vote down vote up
def sci(im):
    """
    Set the current image.  This image will be the target of colormap
    commands like :func:`~matplotlib.pyplot.jet`,
    :func:`~matplotlib.pyplot.hot` or
    :func:`~matplotlib.pyplot.clim`).  The current image is an
    attribute of the current axes.
    """
    gca()._sci(im)


## Any Artist ##
# (getp is simply imported) 
Example 11
Project: neural-network-animation   Author: miloharper   File: pyplot.py    MIT License 5 votes vote down vote up
def hot():
    '''
    set the default colormap to hot and apply to current image if any.
    See help(colormaps) for more information
    '''
    rc('image', cmap='hot')
    im = gci()

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


# This function was autogenerated by boilerplate.py.  Do not edit as
# changes will be lost 
Example 12
Project: GraphicDesignPatternByPython   Author: Relph1119   File: pyplot.py    MIT License 5 votes vote down vote up
def hot():
    """
    Set the colormap to "hot".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    """
    set_cmap("hot")

# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example 13
Project: HiCembler   Author: lpryszcz   File: fastq2array.py    GNU General Public License v3.0 5 votes vote down vote up
def plot(outfn, a, genomeSize, base2chr, _windowSize, dpi=300, ext="svg"):
    """Save contact plot"""
    
    def format_fn(tick_val, tick_pos):
        """Mark axis ticks with chromosome names"""
        if int(tick_val) in base2chr:
            return base2chr[int(tick_val)]
        else:
            sys.stderr.write("[WARNING] %s not in ticks!\n"%tick_val)
            return ''
            
    # invert base2chr
    base2chr = {genomeSize-b: c for b, c in base2chr.iteritems()}
    # start figure
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.set_title("Contact intensity plot [%sk]"%(_windowSize/1000,))
    # label Y axis with chromosome names
    if len(base2chr)<50:
        ax.yaxis.set_major_formatter(FuncFormatter(format_fn))
        ax.yaxis.set_major_locator(MaxNLocator(integer=True))
        plt.yticks(base2chr.keys())
        ax.set_ylabel("Chromosomes")
    else:
        ax.set_ylabel("Genome position")
    # label axes
    ax.set_xlabel("Genome position")        
    plt.imshow(a+1, cmap=cm.hot, norm=LogNorm(), extent=(0, genomeSize, 0, genomeSize))# 
    plt.colorbar()
    # save
    fig.savefig("%s.%s"%(outfn,ext), dpi=dpi, papertype="a4") 
Example 14
Project: HiCembler   Author: lpryszcz   File: bam2plot.py    GNU General Public License v3.0 5 votes vote down vote up
def plot(outfn, a, genomeSize, base2chr, _windowSize, dpi=300, ext="svg"):
    """Save contact plot"""
    
    def format_fn(tick_val, tick_pos):
        """Mark axis ticks with chromosome names"""
        if int(tick_val) in base2chr:
            return base2chr[int(tick_val)]
        else:
            sys.stderr.write("[WARNING] %s not in ticks!\n"%tick_val)
            return ''
            
    # invert base2chr
    base2chr = {genomeSize-b: c for b, c in base2chr.iteritems()}
    # start figure
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.set_title("Contact intensity plot [%sk]"%(_windowSize/1000,))
    # label Y axis with chromosome names
    if len(base2chr)<50:
        ax.yaxis.set_major_formatter(FuncFormatter(format_fn))
        ax.yaxis.set_major_locator(MaxNLocator(integer=True))
        plt.yticks(base2chr.keys())
        ax.set_ylabel("Chromosomes")
    else:
        ax.set_ylabel("Genome position")
    # label axes
    ax.set_xlabel("Genome position")        
    plt.imshow(a+1, cmap=cm.hot, norm=LogNorm(), extent=(0, genomeSize, 0, genomeSize))# 
    plt.colorbar()
    # save
    fig.savefig("%s.%s"%(outfn,ext), dpi=dpi, papertype="a4") 
Example 15
Project: Programming-for-Non-Technical-Roles-   Author: PacktPublishing   File: pyplot.py    MIT License 5 votes vote down vote up
def sci(im):
    """
    Set the current image.  This image will be the target of colormap
    commands like :func:`~matplotlib.pyplot.jet`,
    :func:`~matplotlib.pyplot.hot` or
    :func:`~matplotlib.pyplot.clim`).  The current image is an
    attribute of the current axes.
    """
    gca()._sci(im)


## Any Artist ##
# (getp is simply imported) 
Example 16
Project: Programming-for-Non-Technical-Roles-   Author: PacktPublishing   File: pyplot.py    MIT License 5 votes vote down vote up
def hot():
    """
    Set the colormap to "hot".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    """
    set_cmap("hot")


# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example 17
Project: lucid_utils   Author: calhewitt   File: frameplot.py    MIT License 5 votes vote down vote up
def get_image(frame, colourmode = "BW", normalise=False):
	fig = plt.figure(frameon=False, figsize=(256,256), dpi=1)
	ax = plt.Axes(fig, [0., 0., 1., 1.])
	ax.set_axis_off()
	fig.add_axes(ax)

	cmap = cm.hot
	cmap.set_under("#82bcff")
	vm = np.max(frame) if (np.count_nonzero(frame) > 0) else 2
	ax.imshow(frame, vmin = 1, vmax=vm, cmap = cmap, interpolation='none')

	canvas = plt.get_current_fig_manager().canvas

	agg = canvas.switch_backends(FigureCanvasAgg)
	agg.draw()
	s = agg.tostring_rgb()

	l, b, w, h = agg.figure.bbox.bounds
	w, h = int(w), int(h)

	X = np.fromstring(s, np.uint8)
	X.shape = h, w, 3

	plt.close()

	try:
	    im = Image.fromstring("RGB", (w, h), s)
	except Exception:
	    im = Image.frombytes("RGB", (w, h), s)
	return im 
Example 18
Project: lucid_utils   Author: calhewitt   File: frameplot.py    MIT License 5 votes vote down vote up
def show_frame(frame):
	if not "DISPLAY" in os.environ:
		raise Exception("No display available")
	fig, ax = plt.subplots()
	cmap = cm.hot
	cmap.set_under("#82bcff")
	vm = np.max(frame) if (np.count_nonzero(frame) > 0) else 2
	cax = ax.imshow(frame, vmin = 1, vmax=vm, cmap = cmap, interpolation='none')
	fig.colorbar(cax)
	plt.show() 
Example 19
Project: lucid_utils   Author: calhewitt   File: frameplot.py    MIT License 5 votes vote down vote up
def fig_frame(frame):
	fig, ax = plt.subplots()
	cmap = cm.hot
	cmap.set_under("#82bcff")
	vm = np.max(frame) if (np.count_nonzero(frame) > 0) else 2
	cax = ax.imshow(frame, vmin = 1, vmax=vm, cmap = cmap, interpolation='none')
	fig.colorbar(cax)
	return fig 
Example 20
Project: psychrometric-chart-makeover   Author: buds-lab   File: pyplot.py    MIT License 5 votes vote down vote up
def hot():
    """
    Set the colormap to "hot".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    """
    set_cmap("hot")


# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example 21
Project: PySNN   Author: BasBuller   File: file_io.py    MIT License 5 votes vote down vote up
def _show_td_1d(TD, frame_rate=24, pre_compute_frames=True, repeat=False):
    assert TD.dim != 1, f"Expected TD dimension to be 1. It was: {TD.dim}"
    fig = plt.figure()
    interval = 1e3 / frame_rate  # in ms
    x_dim = TD.x.max() + 1
    tMax = TD.t.max()
    tMin = TD.t.min()
    pMax = TD.p.max() + 1
    min_frame = int(np.floor(tMin / interval))
    max_frame = int(np.ceil(tMax / interval)) + 1

    # ignore pre_compute_frames

    def animate(i):
        fig.clear()
        t_end = (i + min_frame + 1) * interval
        ind = TD.t < t_end
        # plot raster
        plt.plot(TD.t[ind], TD.x[ind], ".")
        # plt.plot(TD.t[ind], TD.x[ind], '.', c=cm.hot(TD.p[ind]))
        # plot raster scan line
        plt.plot([t_end + interval, t_end + interval], [0, x_dim])
        plt.axis((tMin - 0.1 * tMax, 1.1 * tMax, -0.1 * x_dim, 1.1 * x_dim))
        plt.draw()

    anim = animation.FuncAnimation(
        fig, animate, frames=max_frame, interval=42, repeat=repeat
    )  # 42 means playback at 23.809 fps

    return anim 
Example 22
Project: SignLanguage_ML   Author: mareep-raljodid   File: pyplot.py    MIT License 5 votes vote down vote up
def hot():
    """
    Set the colormap to "hot".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    """
    set_cmap("hot")


# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example 23
Project: Blackjack-Tracker   Author: martinabeleda   File: pyplot.py    MIT License 5 votes vote down vote up
def sci(im):
    """
    Set the current image.  This image will be the target of colormap
    commands like :func:`~matplotlib.pyplot.jet`,
    :func:`~matplotlib.pyplot.hot` or
    :func:`~matplotlib.pyplot.clim`).  The current image is an
    attribute of the current axes.
    """
    gca()._sci(im)


## Any Artist ##
# (getp is simply imported) 
Example 24
Project: Blackjack-Tracker   Author: martinabeleda   File: pyplot.py    MIT License 5 votes vote down vote up
def hot():
    '''
    set the default colormap to hot and apply to current image if any.
    See help(colormaps) for more information
    '''
    rc('image', cmap='hot')
    im = gci()

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


# This function was autogenerated by boilerplate.py.  Do not edit as
# changes will be lost 
Example 25
Project: FRHEED   Author: ecyoung3   File: FRHEED 2.0.0.py    GNU General Public License v3.0 5 votes vote down vote up
def mapHot(self):
        global cmap
        cmap = cm.hot
        
    #### Mouse tracking on graphs #### 
Example 26
Project: lambda-tensorflow-object-detection   Author: mikylucky   File: pyplot.py    GNU General Public License v3.0 5 votes vote down vote up
def hot():
    """
    Set the colormap to "hot".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    """
    set_cmap("hot")


# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example 27
Project: cnidaria   Author: sauloal   File: pyplot.py    MIT License 5 votes vote down vote up
def sci(im):
    """
    Set the current image.  This image will be the target of colormap
    commands like :func:`~matplotlib.pyplot.jet`,
    :func:`~matplotlib.pyplot.hot` or
    :func:`~matplotlib.pyplot.clim`).  The current image is an
    attribute of the current axes.
    """
    gca()._sci(im)


## Any Artist ##
# (getp is simply imported) 
Example 28
Project: cnidaria   Author: sauloal   File: pyplot.py    MIT License 5 votes vote down vote up
def hot():
    '''
    set the default colormap to hot and apply to current image if any.
    See help(colormaps) for more information
    '''
    rc('image', cmap='hot')
    im = gci()

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


# This function was autogenerated by boilerplate.py.  Do not edit as
# changes will be lost