本文整理匯總了Python中pylab.suptitle方法的典型用法代碼示例。如果您正苦於以下問題:Python pylab.suptitle方法的具體用法?Python pylab.suptitle怎麽用?Python pylab.suptitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pylab
的用法示例。
在下文中一共展示了pylab.suptitle方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: contour_mult_mo
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import suptitle [as 別名]
def contour_mult_mo(self,x,y,mo,xlabel='x',ylabel='y',title='',r0=0):
'''Uses matplotlib to show slices of a molecular orbitals.'''
import matplotlib.pyplot as plt
# Plot slices
f, pics = \
plt.subplots(len(mo),1,sharex=True,sharey=True,figsize=(6,2+4*len(mo)))
plt.suptitle(title)
vmax = numpy.max(numpy.abs(mo))
for i,pic in enumerate(pics):
pic.contour(y,x,mo[i],50,linewidths=0.5,colors='k')
pic.contourf(\
y,x,mo[i],50,cmap=plt.cm.rainbow,vmax=vmax,vmin=-vmax)
pic.set_ylabel(xlabel)
pic.set_xlabel(ylabel)
pic.set_title('Data Point %d' % (r0+i))
f.subplots_adjust(left=0.15,bottom=0.05,top=0.95,right=0.95)
f.show()
return f,pics
示例2: plot_item
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import suptitle [as 別名]
def plot_item(self, m, ind, x, r, k, label, U,
rerr, feature_weights):
if x == [] or r == []:
print "Error: No data in x and/or r."
return
pylab.clf()
# xvals, x, and r need to be column vectors
# xvals represent bin end points, so we need to duplicate most of them
x = np.repeat(x, 2, axis=0)
r = np.repeat(r, 2, axis=0)
pylab.subplot(2,1,1)
pylab.semilogx(self.xvals, r[0:128], 'r-', label='Expected')
pylab.semilogx(self.xvals, x[0:128], 'b.-', label='Observations')
pylab.xlabel('CTN: ' + self.xlabel)
pylab.ylabel(self.ylabel)
pylab.legend(loc='upper left', fontsize=10)
pylab.subplot(2,1,2)
pylab.semilogx(self.xvals, r[128:], 'r-', label='Expected')
pylab.semilogx(self.xvals, x[128:], 'b.-', label='Observations')
pylab.xlabel('CETN: ' + self.xlabel)
pylab.ylabel(self.ylabel)
pylab.legend(loc='upper left', fontsize=10)
pylab.suptitle('DEMUD selection %d (%s), item %d, using K=%d' % \
(m, label, ind, k))
outdir = os.path.join('results', self.name)
if not os.path.exists(outdir):
os.mkdir(outdir)
figfile = os.path.join(outdir, 'sel-%d-k-%d-(%s).pdf' % (m, k, label))
pylab.savefig(figfile)
print 'Wrote plot to %s' % figfile
pylab.close()
示例3: process_files
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import suptitle [as 別名]
def process_files(files, basedir='./data', debug=False, rectify=False,
outdir='./data/for-labelme', **kwargs):
attempts = 0
n = len(files)
print "Rectify is set to", rectify
try:
os.makedirs(outdir)
except OSError as e:
pass
if debug:
try:
os.makedirs(os.path.join(outdir, 'debug'))
except OSError as e:
# Directory already exists
pass
for i, f in enumerate(files):
try:
newbasename = rename_file(f, basedir)
newname = os.path.join(outdir, newbasename)
print i + 1, 'of', n, newname
image = imread(f)
if rectify:
try:
meta = {}
rectified = rectify_building(image, meta)
if debug:
import pylab as pl
h = meta['homography']
pl.suptitle('u:{} d:{} l:{} r:{}'.format(h.du, h.dd, h.dl, h.dr))
pl.subplot(221)
pl.imshow(image)
pl.axis('off')
pl.subplot(222)
pl.imshow(meta['building'])
pl.axis('off')
pl.subplot(223)
h.plot_original()
pl.subplot(224)
h.plot_rectified()
pl.savefig(os.path.join(outdir, 'debug', newbasename))
imsave(newname, rectified)
except Exception as e:
print e
pass
else:
imsave(newname, image)
except Exception as e:
print e