本文整理匯總了Python中matplotlib.pyplot.hexbin方法的典型用法代碼示例。如果您正苦於以下問題:Python pyplot.hexbin方法的具體用法?Python pyplot.hexbin怎麽用?Python pyplot.hexbin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類matplotlib.pyplot
的用法示例。
在下文中一共展示了pyplot.hexbin方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: plot_pixels
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import hexbin [as 別名]
def plot_pixels(file_name, candidate_data_single_band,
reference_data_single_band, limits=None, fit_line=None):
logging.info('Display: Creating pixel plot - {}'.format(file_name))
fig = plt.figure()
plt.hexbin(
candidate_data_single_band, reference_data_single_band, mincnt=1)
if not limits:
min_value = 0
_, ymax = plt.gca().get_ylim()
_, xmax = plt.gca().get_xlim()
max_value = max([ymax, xmax])
limits = [min_value, max_value]
plt.plot(limits, limits, 'k-')
if fit_line:
start = limits[0] * fit_line.gain + fit_line.offset
end = limits[1] * fit_line.gain + fit_line.offset
plt.plot(limits, [start, end], 'g-')
plt.xlim(limits)
plt.ylim(limits)
plt.xlabel('Candidate DNs')
plt.ylabel('Reference DNs')
fig.savefig(file_name, bbox_inches='tight')
plt.close(fig)
示例2: make_2d_hist
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import hexbin [as 別名]
def make_2d_hist(data, name):
f = plt.figure()
X,Y = np.meshgrid(range(data.shape[0]), range(data.shape[1]))
im = plt.pcolormesh(X,Y,data.transpose(), cmap='seismic')
plt.colorbar(im, orientation='vertical')
# plt.hexbin(data,data)
# plt.show()
f.savefig(pjoin(FLAGS.output_dir, name + '.png'))
plt.close()
# def make_2d_hexbin(data, name):
# f = plt.figure()
# X,Y = np.meshgrid(range(data.shape[0]), range(data.shape[1]))
# plt.hexbin(X, data)
# # plt.show()
# f.savefig(pjoin(FLAGS.output_dir, name + '.png'))
示例3: hexbin_alex
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import hexbin [as 別名]
def hexbin_alex(d, i=0, vmin=1, vmax=None, gridsize=80, cmap='Spectral_r',
E_name='E', S_name='S', **hexbin_kwargs):
"""Plot an hexbin 2D histogram for E-S.
"""
if d.num_bursts[i] < 1:
return
hexbin_kwargs_ = dict(edgecolor='none', linewidth=0.2, gridsize=gridsize,
cmap=cmap, extent=(-0.2, 1.2, -0.2, 1.2), mincnt=1)
if hexbin_kwargs is not None:
hexbin_kwargs_.update(_normalize_kwargs(hexbin_kwargs))
poly = plt.hexbin(d[E_name][i], d[S_name][i], **hexbin_kwargs_)
poly.set_clim(vmin, vmax)
plt.xlabel('E')
plt.ylabel('S')
示例4: _alex_hexbin_vmax
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import hexbin [as 別名]
def _alex_hexbin_vmax(patches, vmax_fret=True, Smax=0.8):
"""Return the max counts in the E-S hexbin histogram in `patches`.
When `vmax_fret` is True, returns the max count for S < Smax.
Otherwise returns the max count in all the histogram.
"""
counts = patches.get_array()
if vmax_fret:
offset = patches.get_offsets()
xoffset, yoffset = offset[:, 0], offset[:, 1]
mask = yoffset < Smax
vmax = counts[mask].max()
else:
vmax = counts.max()
return vmax
示例5: HexBin
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import hexbin [as 別名]
def HexBin(xs, ys, **options):
"""Makes a scatter plot.
xs: x values
ys: y values
options: options passed to plt.scatter
"""
options = _Underride(options, cmap=matplotlib.cm.Blues)
plt.hexbin(xs, ys, **options)
示例6: plot_results
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import hexbin [as 別名]
def plot_results(talkers,classifiers,savefig=False):
plt.subplot(111)
x,y,s = [],[],[]
count_talkers = Counter(talkers)
count_classifiers = Counter(classifiers)
for k in count_talkers:
if count_classifiers.has_key(k):
x.append(count_talkers[k])
y.append(count_classifiers[k])
xmin = np.min(x)
xmax = np.max(x)
ymin = np.min(y)
ymax = np.max(y)
plt.hexbin(x,y,gridsize=(20,20),bins='log',cmap=plt.cm.viridis)
plt.axis([xmin,xmax,ymin,ymax])
cb = plt.colorbar()
cb.set_label(r'$\log_{10} N$')
plt.xlabel(r'$N_{talk comments}$',fontsize=25)
plt.ylabel(r'$N_{classifications}$',fontsize=25)
plt.tight_layout()
if savefig:
plt.savefig('talk_contributions_{0}.png'.format(project_name))
else:
plt.show()
return None
示例7: HexBin
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import hexbin [as 別名]
def HexBin(xs, ys, **options):
"""Makes a scatter plot.
xs: x values
ys: y values
options: options passed to pyplot.scatter
"""
options = _Underride(options, cmap=matplotlib.cm.Blues)
pyplot.hexbin(xs, ys, **options)