本文整理匯總了Python中pylab.plt.title方法的典型用法代碼示例。如果您正苦於以下問題:Python plt.title方法的具體用法?Python plt.title怎麽用?Python plt.title使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pylab.plt
的用法示例。
在下文中一共展示了plt.title方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: cumulative_freq_plot
# 需要導入模塊: from pylab import plt [as 別名]
# 或者: from pylab.plt import title [as 別名]
def cumulative_freq_plot(rast, band=0, mask=None, bins=100, xlim=None, nodata=-9999):
'''
Plots an empirical cumulative frequency curve for the input raster array
in a given band. NOTE: Thiscurrently only works for single-band arrays.
'''
if mask is not None:
arr = binary_mask(rast, mask)
else:
arr = rast.copy()
if nodata is not None:
arr = subarray(arr)
values, base = np.histogram(arr, bins=bins)
cumulative = np.cumsum(values) # Evaluate the cumulative distribution
plt.plot(base[:-1], cumulative, c='blue') # Plot the cumulative function
plt.title('Empirical Cumulative Distribution: Band %d' % band)
if xlim is not None:
axes = plt.gca()
axes.set_xlim(xlim)
plt.show()
return arr
示例2: histogram
# 需要導入模塊: from pylab import plt [as 別名]
# 或者: from pylab.plt import title [as 別名]
def histogram(arr, valid_range=(0, 1), bins=10, normed=False, cumulative=False,
file_path='hist.png', title=None):
'''
Plots a histogram for an input array over a specified range.
'''
# Can accept either a gdal.Dataset or numpy.array instance
if not isinstance(arr, np.ndarray):
arr = arr.ReadAsArray()
plt.hist(arr.ravel(), range=valid_range, bins=bins, normed=normed,
cumulative=cumulative)
if title is not None:
plt.title(title)
plt.savefig(file_path)