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