本文整理汇总了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