示例#1
0
def plotst(y, titlestr):
        n = min(minimum.reduce(y))
        m = max(maximum.reduce(y))
#        n = 0
#        m = 9e+6
        nlevels = 40
        clevel = linspace(n, m, nlevels)
        ticks, mticks = scale1(clevel[0], clevel[-1])
        time = linspace(t0, t1, y.shape[1])
        fr = linspace(lo, hi, y.shape[0])
        if ref:
                subplot(211)
        c = contourf(time, fr, y, clevel, cmap = cm.jet)
#        c = contourf(time, fr, y, clevel, cmap = cm.hsv)
        cax = gca()
        cax.set_xlim(t0, t1)
        cax.set_ylim(lo, hi)
        title(titlestr, fontsize = 15)
        colorbar(format = '%.2g', ticks = ticks)
        if ref:
                #from matplotlib.colorbar import make_axes
                newright = cax.get_position().x1
                subplot(212)
                plot(time, r)
                # ensure the x axis takes up the same amount of space
                ax = gca()
                p = ax.get_position()
                p.x1 = newright
                ax.set_position(p)
                # ensure the x axis has the same range
                a = list(ax.axis())
                a[0:2] = cax.axis()[0:2]
                ax.axis(a)
示例#2
0
m = max(maximum.reduce(s))

# Sanity check.
if n == m:
	printerror("brik contains no data")
	sys.exit(0)

if rlo is not None:
	n = rlo
	m = rhi

from pyctf.sensortopo.tics import scale1

nlevels = 40
clevel = linspace(n, m, nlevels)
ticks, mticks = scale1(clevel[0], clevel[-1])
hold(True)
time = linspace(start, end, s.shape[1])
fr = linspace(lo, hi, s.shape[0])
contourf(time, fr, s, clevel, cmap = cm.jet)
ax = gca()
colorbar(format = '%.2g', ticks = ticks)
ax.set_xlabel('Time (s)')
ax.set_ylabel('Frequency (Hz)')
nlevels = 7
clevel = linspace(n, m, nlevels)
contour(time, fr, s, clevel, colors = 'black')
title(titlestr, x = 0, horizontalalignment = 'left', fontsize = 15)
ax.set_xlim(start, end)
ax.set_ylim(lo, hi)