本文整理汇总了Python中matplotlib.pylab.figure函数的典型用法代码示例。如果您正苦于以下问题:Python figure函数的具体用法?Python figure怎么用?Python figure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了figure函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: plot_experiment_stats
def plot_experiment_stats(e):
sample_data = np.where(e.num_test_genotypes(SAMPLE) > 0)[0]
c_sample = (100.0 * e.called(SAMPLE)[sample_data]) / e.num_test_genotypes(SAMPLE)[sample_data] + 1e-15
fill = 100.*e.fill[sample_data]
snp_data = np.where(e.num_test_genotypes(SNP) > 0)[0]
c_snp = (100.0 * e.called(SNP)[snp_data]) / e.num_test_genotypes(SNP)[snp_data]
# Call % vs. fill %
P.figure(1);
P.clf();
P.plot(fill, c_sample, 'o')
P.xlabel('Fill %')
P.ylabel('Call %')
P.title('Validation Breakdown by Sample, %.2f%% Deleted. r = %.2f' %
(100.0 * e.fraction, np.corrcoef(fill + SMALL_FLOAT, c_sample + SMALL_FLOAT)[0, 1],))
# Call % vs. SNP
P.figure(2);
P.clf();
P.plot(snp_data, c_snp, 'o')
P.xlabel('SNP #')
P.ylabel('Call %')
P.title('Validation Breakdown by SNP, %.2f%% Deleted' % (100.0 * e.fraction,))
return (np.array([snp_data, c_snp]).transpose(),
np.array([sample_data, c_sample, fill]).transpose())
开发者ID:orenlivne,项目名称:ober,代码行数:27,代码来源:plots.py
示例2: make_corr1d_fig
def make_corr1d_fig(dosave=False):
corr = make_corr_both_hemi()
lw=2; fs=16
pl.figure(1)#, figsize=(8, 7))
pl.clf()
pl.xlim(4,300)
pl.ylim(-400,+500)
lambda_titles = [r'$20 < \lambda < 30$',
r'$30 < \lambda < 40$',
r'$\lambda > 40$']
colors = ['blue','green','red']
for i in range(3):
corr1d, rcen = corr_1d_from_2d(corr[i])
ipdb.set_trace()
pl.semilogx(rcen, corr1d*rcen**2, lw=lw, color=colors[i])
#pl.semilogx(rcen, corr1d*rcen**2, 'o', lw=lw, color=colors[i])
pl.xlabel(r'$s (Mpc)$',fontsize=fs)
pl.ylabel(r'$s^2 \xi_0(s)$', fontsize=fs)
pl.legend(lambda_titles, 'lower left', fontsize=fs+3)
pl.plot([.1,10000],[0,0],'k--')
s_bao = 149.28
pl.plot([s_bao, s_bao],[-9e9,+9e9],'k--')
pl.text(s_bao*1.03, 420, 'BAO scale')
pl.text(s_bao*1.03, 370, '%0.1f Mpc'%s_bao)
if dosave: pl.savefig('xi1d_3bin.pdf')
开发者ID:amanzotti,项目名称:vksz,代码行数:25,代码来源:vksz.py
示例3: analyze_categorical_feature
def analyze_categorical_feature(self, data_frame, feature_name):
data = FeatureAnalyzer.convert_into_one_hot_representation(data_frame, feature_name)
data.is_copy = False
data['label'] = data['label'].astype(int).apply(lambda x: 0 if x == -1 else 1)
result_dict = {'category': [], 'correlation': [], 'abs_correlation': [], 'fraction': [], 'rate': []}
for key in data.keys():
if key != 'label':
result_dict['category'].append(key)
key_data = data[['label', key]][data[key] == 1]
num_engagements = len(key_data[key_data['label'] == 1])
if len(key_data) > 0:
result_dict['correlation'].append(data[[key, 'label']].corr().values[0, 1])
result_dict['abs_correlation'].append(abs(result_dict['correlation'][-1]))
result_dict['fraction'].append(len(key_data)/float(len(data)))
result_dict['rate'].append(num_engagements/float(len(key_data)))
else:
result_dict['correlation'].append(0.0)
result_dict['abs_correlation'].append(0.0)
result_dict['fraction'].append(0.0)
result_dict['rate'].append(0.0)
plt.figure()
result = pandas.DataFrame(data=result_dict).sort(columns='abs_correlation', ascending=False)
fig = result.plot(x='category', y=['correlation', 'fraction', 'rate'], kind='bar', stacked=True, figsize=(len(data)/200, 10)).get_figure()
fig.set_tight_layout(True)
png_path = 'Data/' + self.experiment_name + '_' + feature_name + '.png'
fig.savefig(png_path, dpi=fig.dpi)
开发者ID:abhitopia,项目名称:FeatureEvaluationFrameWork,代码行数:27,代码来源:FeatureAnalyzer.py
示例4: test1
def test1():
x = [0.5]*3
xbounds = [(-5, 5) for y in x]
GA = GenAlg(fitcalc1, x, xbounds, popMult=100, bitsPerGene=9, mutation=(1./9.), crossover=0.65, crossN=2, direction='min', maxGens=60, hammingDist=False)
results = GA.run()
print "*** DONE ***"
#print results
plt.ioff()
#generate pareto frontier numerically
x1_ = np.arange(-5., 0., 0.05)
x2_ = np.arange(-5., 0., 0.05)
x3_ = np.arange(-5., 0., 0.05)
pfn = []
for x1 in x1_:
for x2 in x2_:
for x3 in x3_:
pfn.append(fitcalc1([x1,x2,x3]))
pfn.sort(key=lambda x:x[0])
plt.figure()
i = 0
for x in results:
plt.scatter(x[1][0], x[1][1], 20, c='r')
plt.scatter([x[0] for x in pfn], [x[1] for x in pfn], 1.0, c='b', alpha=0.1)
plt.xlim([-20,-1])
plt.ylim([-12, 2])
plt.draw()
开发者ID:pattersoniv,项目名称:FFAS,代码行数:32,代码来源:NGSA.py
示例5: plot_grid_experiment_results
def plot_grid_experiment_results(grid_results, params, metrics):
global plt
params = sorted(params)
grid_params = grid_results.grid_params
plt.figure(figsize=(8, 6))
for metric in metrics:
grid_params_shape = [len(grid_params[k]) for k in sorted(grid_params.keys())]
params_max_out = [(1 if k in params else 0) for k in sorted(grid_params.keys())]
results = np.array([e.results.get(metric, 0) for e in grid_results.experiments])
results = results.reshape(*grid_params_shape)
for axis, included_in_params in enumerate(params_max_out):
if not included_in_params:
results = np.apply_along_axis(np.max, axis, results)
print results
params_shape = [len(grid_params[k]) for k in sorted(params)]
results = results.reshape(*params_shape)
if len(results.shape) == 1:
results = results.reshape(-1,1)
import matplotlib.pylab as plt
#f.subplots_adjust(left=.2, right=0.95, bottom=0.15, top=0.95)
plt.imshow(results, interpolation='nearest', cmap=plt.cm.hot)
plt.title(str(grid_results.name) + " " + metric)
if len(params) == 2:
plt.xticks(np.arange(len(grid_params[params[1]])), grid_params[params[1]], rotation=45)
plt.yticks(np.arange(len(grid_params[params[0]])), grid_params[params[0]])
plt.colorbar()
plt.show()
开发者ID:gmum,项目名称:mlls2015,代码行数:31,代码来源:utils.py
示例6: test_flux
def test_flux(self):
tol = 150.
inputcat = catalog.read(os.path.join(self.args.tmp_path, 'ccd_1.cat'))
pixradius = 3*self.target["psf"]/self.instrument["PIXEL_SCALE"]
positions = list(zip(inputcat["X_IMAGE"]-1, inputcat["Y_IMAGE"]-1))
fluxes = image.simple_aper_phot(self.im[1], positions, pixradius)
sky_background = image.annulus_photometry(self.im[1], positions,
pixradius+5, pixradius+8)
total_bg_pixels = np.shape(image.build_annulus_mask(pixradius+5, pixradius+8, positions[0]))[1]
total_source_pixels = np.shape(image.build_circle_mask(pixradius,
positions[0]))[1]
estimated_fluxes = fluxes - sky_background*1./total_bg_pixels*total_source_pixels
estimated_magnitude = image.flux2mag(estimated_fluxes,
self.im[1].header['SIMMAGZP'], self.target["exptime"])
expected_flux = image.mag2adu(17.5, self.target["zeropoint"][0],
exptime=self.target["exptime"])
p.figure()
p.hist(fluxes, bins=50)
p.title('Expected flux: {:0.2f}, mean flux: {:1.2f}'.format(expected_flux, np.mean(estimated_fluxes)))
p.savefig(os.path.join(self.figdir,'Fluxes.png'))
assert np.all(np.abs(fluxes-expected_flux) < tol)
开发者ID:rfahed,项目名称:extProcess,代码行数:27,代码来源:photometry_test.py
示例7: item_nbr_tendency_finely
def item_nbr_tendency_finely(store_nbr, year, month_start=-1, month_end=-1, graph=True):
'''
input
1. store_nbr = 스토어 번호
2. year = 연도
3. month_start = 시작달
4. month_start = 끝달
5. graph = 위의 정보에 대한 item_nbr 그래프 출력여부
output
1. store_nbr, year, month로 filtering한 item_nbr의 pivot 테이블
'''
store = df_1[(df_1['store_nbr'] == store_nbr) &
(df_1['year'] == year)]
if month_start != -1:
if month_end == -1:
month_end = month_start + 1
store = store[(month_start <= store['month']) & (store['month'] < month_end)]
pivot = store.pivot_table(index='item_nbr',
columns='date',
values='units',
aggfunc=np.sum)
zero_index = pivot == 0
pivot = pivot[pivot != 0].dropna(axis=0, how='all')
pivot[zero_index] = 0
if graph:
plt.figure(figsize=(12, 8))
sns.heatmap(pivot, cmap="YlGnBu", annot=True, fmt='.0f')
plt.show()
return pivot
开发者ID:atyams,项目名称:kaggle-walmart-sales-in-stormy-weather,代码行数:35,代码来源:jw_package.py
示例8: item_nbr_tendency
def item_nbr_tendency(store_nbr):
'''
input : store_nbr
output : graph representing units groupped by each year, each month
'''
store = df_1[df_1['store_nbr'] == store_nbr]
pivot = store.pivot_table(index=['year','month'],columns='item_nbr',values='units',aggfunc=np.sum)
zero_index = pivot==0
pivot = pivot[pivot!=0].dropna(axis=1,how='all')
pivot[zero_index]=0
pivot_2012 = pivot.loc[2012]
pivot_2013 = pivot.loc[2013]
pivot_2014 = pivot.loc[2014]
plt.figure(figsize=(12,8))
plt.subplot(131)
sns.heatmap(pivot_2012,cmap="YlGnBu", annot = True, fmt = '.0f')
plt.subplot(132)
sns.heatmap(pivot_2013,cmap="YlGnBu", annot = True, fmt = '.0f')
plt.subplot(133)
sns.heatmap(pivot_2014,cmap="YlGnBu", annot = True, fmt = '.0f')
plt.show()
开发者ID:atyams,项目名称:kaggle-walmart-sales-in-stormy-weather,代码行数:25,代码来源:jw_package.py
示例9: flipPlot
def flipPlot(minExp, maxExp):
"""假定minEXPy和maxExp是正整数且minExp<maxExp
绘制出2**minExp到2**maxExp次抛硬币的结果
"""
ratios = []
diffs = []
aAxis = []
for i in range(minExp, maxExp+1):
aAxis.append(2**i)
for numFlips in aAxis:
numHeads = 0
for n in range(numFlips):
if random.random() < 0.5:
numHeads += 1
numTails = numFlips - numHeads
ratios.append(numHeads/numFlips)
diffs.append(abs(numHeads-numTails))
plt.figure()
ax1 = plt.subplot(121)
plt.title("Difference Between Heads and Tails")
plt.xlabel('Number of Flips')
plt.ylabel('Abs(#Heads - #Tails)')
ax1.semilogx(aAxis, diffs, 'bo')
ax2 = plt.subplot(122)
plt.title("Heads/Tails Ratios")
plt.xlabel('Number of Flips')
plt.ylabel("#Heads/#Tails")
ax2.semilogx(aAxis, ratios, 'bo')
plt.show()
开发者ID:xiaohu2015,项目名称:ProgrammingPython_notes,代码行数:29,代码来源:chapter12.py
示例10: handle
def handle(self, *args, **options):
try:
from matplotlib import pylab as pl
import numpy as np
except ImportError:
raise Exception('Be sure to install requirements_scipy.txt before running this.')
all_names_and_counts = RawCommitteeTransactions.objects.all().values('attest_by_name').annotate(total=Count('attest_by_name')).order_by('-total')
all_names_and_counts_as_tuple_and_sorted = sorted([(row['attest_by_name'], row['total']) for row in all_names_and_counts], key=lambda row: row[1])
print "top ten attestors: (name, number of transactions they attest for)"
for row in all_names_and_counts_as_tuple_and_sorted[-10:]:
print row
n_bins = 100
filename = 'attestor_participation_distribution.png'
x_max = all_names_and_counts_as_tuple_and_sorted[-31][1] # eliminate top outliers from hist
x_min = all_names_and_counts_as_tuple_and_sorted[0][1]
counts = [row['total'] for row in all_names_and_counts]
pl.figure(1, figsize=(18, 6))
pl.hist(counts, bins=np.arange(x_min, x_max, (float(x_max)-x_min)/100) )
pl.title('Histogram of Attestor Participation in RawCommitteeTransactions')
pl.xlabel('Number of transactions a person attested for')
pl.ylabel('Number of people')
pl.savefig(filename)
开发者ID:avaleske,项目名称:hackor,代码行数:26,代码来源:graph_dist_of_attestor_contribution_in_CommTrans.py
示例11: check_models
def check_models(self):
plt.figure('Bandgap narrowing')
Na = np.logspace(12, 20)
Nd = 0.
dn = 1e14
temp = 300.
for author in self.available_models():
BGN = self.update(Na=Na, Nd=Nd, nxc=dn,
author=author,
temp=temp)
if not np.all(BGN == 0):
plt.plot(Na, BGN, label=author)
test_file = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'Si', 'check data', 'Bgn.csv')
data = np.genfromtxt(test_file, delimiter=',', names=True)
for name in data.dtype.names[1:]:
plt.plot(
data['N'], data[name], 'r--',
label='PV-lighthouse\'s: ' + name)
plt.semilogx()
plt.xlabel('Doping (cm$^{-3}$)')
plt.ylabel('Bandgap narrowing (K)')
plt.legend(loc=0)
开发者ID:MK8J,项目名称:QSSPL-analyser,代码行数:31,代码来源:bandgap_narrowing.py
示例12: XXtest5_regrid
def XXtest5_regrid(self):
srcF = cdms2.open(sys.prefix + \
'/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc')
so = srcF('so')[0, 0, ...]
clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')
dstData = so.regrid(clt.getGrid(),
regridTool = 'esmf',
regridMethod='conserve')
if self.pe == 0:
dstDataMask = (dstData == so.missing_value)
dstDataFltd = dstData * (1 - dstDataMask)
zeroValCnt = (dstData == 0).sum()
if so.missing_value > 0:
dstDataMin = dstData.min()
dstDataMax = dstDataFltd.max()
else:
dstDataMin = dstDataFltd.min()
dstDataMax = dstData.max()
zeroValCnt = (dstData == 0).sum()
print 'Number of zero valued cells', zeroValCnt
print 'min/max value of dstData: %f %f' % (dstDataMin, dstDataMax)
self.assertLess(dstDataMax, so.max())
if False:
pylab.figure(1)
pylab.pcolor(so, vmin=20, vmax=40)
pylab.colorbar()
pylab.title('so')
pylab.figure(2)
pylab.pcolor(dstData, vmin=20, vmax=40)
pylab.colorbar()
pylab.title('dstData')
开发者ID:NCPP,项目名称:uvcdat-devel,代码行数:32,代码来源:testEsmfSalinity.py
示例13: plot_waveforms
def plot_waveforms(time,voltage,APTimes,titlestr):
"""
plot_waveforms takes four arguments - the recording time array, the voltage
array, the time of the detected action potentials, and the title of your
plot. The function creates a labeled plot showing the waveforms for each
detected action potential
"""
plt.figure()
## Your Code Here
indices = []
for x in range(len(APTimes)):
for i in range(len(time)):
if(time[i]==APTimes[x]):
indices.append(i)
##print indices
Xval = np.linspace(-.003,.003,200)
print len(Xval)
for x in range(len(APTimes)):
plt.plot(Xval, voltage[indices[x]-100:indices[x]+100])
plt.title(titlestr)
plt.xlabel('Time (s)')
plt.ylabel('Voltage (uV)')
plt.hold(True)
plt.show()
开发者ID:cbuscaron,项目名称:NeuralData,代码行数:32,代码来源:problem_set1.py
示例14: visualization2
def visualization2(self, sp_to_vis=None):
if sp_to_vis:
species_ready = list(set(sp_to_vis).intersection(self.all_sp_signatures.keys()))
else:
raise Exception('list of driver species must be defined')
if not species_ready:
raise Exception('None of the input species is a driver')
for sp in species_ready:
# Setting up figure
plt.figure()
plt.subplot(313)
mon_val = OrderedDict()
signature = self.all_sp_signatures[sp]
for idx, mon in enumerate(list(set(signature))):
if mon[0] == 'C':
mon_val[self.all_comb[sp][mon] + (-1,)] = idx
else:
mon_val[self.all_comb[sp][mon]] = idx
mon_rep = [0] * len(signature)
for i, m in enumerate(signature):
if m[0] == 'C':
mon_rep[i] = mon_val[self.all_comb[sp][m] + (-1,)]
else:
mon_rep[i] = mon_val[self.all_comb[sp][m]]
# mon_rep = [mon_val[self.all_comb[sp][m]] for m in signature]
y_pos = numpy.arange(len(mon_val.keys()))
plt.scatter(self.tspan[1:], mon_rep)
plt.yticks(y_pos, mon_val.keys())
plt.ylabel('Monomials', fontsize=16)
plt.xlabel('Time(s)', fontsize=16)
plt.xlim(0, self.tspan[-1])
plt.ylim(0, max(y_pos))
plt.subplot(312)
for name in self.model.odes[sp].as_coefficients_dict():
mon = name
mon = mon.subs(self.param_values)
var_to_study = [atom for atom in mon.atoms(sympy.Symbol)]
arg_f1 = [numpy.maximum(self.mach_eps, self.y[str(va)][1:]) for va in var_to_study]
f1 = sympy.lambdify(var_to_study, mon)
mon_values = f1(*arg_f1)
mon_name = str(name).partition('__')[2]
plt.plot(self.tspan[1:], mon_values, label=mon_name)
plt.ylabel('Rate(m/sec)', fontsize=16)
plt.legend(bbox_to_anchor=(-0.1, 0.85), loc='upper right', ncol=1)
plt.subplot(311)
plt.plot(self.tspan[1:], self.y['__s%d' % sp][1:], label=parse_name(self.model.species[sp]))
plt.ylabel('Molecules', fontsize=16)
plt.legend(bbox_to_anchor=(-0.15, 0.85), loc='upper right', ncol=1)
plt.suptitle('Tropicalization' + ' ' + str(self.model.species[sp]))
# plt.show()
plt.savefig('s%d' % sp + '.png', bbox_inches='tight', dpi=400)
开发者ID:LoLab-VU,项目名称:tropical,代码行数:60,代码来源:max_plus.py
示例15: _fig_density
def _fig_density(sweight, surweight, pval, nlm):
"""
Plot the histogram of sweight across the image
and the thresholds implied by the surrogate model (surweight)
"""
import matplotlib.pylab as mp
# compute some thresholds
nlm = nlm.astype('d')
srweight = np.sum(surweight,1)
srw = np.sort(srweight)
nitem = np.size(srweight)
thf = srw[int((1-min(pval,1))*nitem)]
mnlm = max(1,nlm.mean())
imin = min(nitem-1,int((1.-pval/mnlm)*nitem))
thcf = srw[imin]
h,c = np.histogram(sweight,100)
I = h.sum()*(c[1]-c[0])
h = h/I
h0,c0 = np.histogram(srweight,100)
I0 = h0.sum()*(c0[1]-c0[0])
h0 = h0/I0
mp.figure(1)
mp.plot(c,h)
mp.plot(c0,h0)
mp.legend(('true histogram','surrogate histogram'))
mp.plot([thf,thf],[0,0.8*h0.max()])
mp.text(thf,0.8*h0.max(),'p<0.2, uncorrected')
mp.plot([thcf,thcf],[0,0.5*h0.max()])
mp.text(thcf,0.5*h0.max(),'p<0.05, corrected')
mp.savefig('/tmp/histo_density.eps')
mp.show()
开发者ID:cindeem,项目名称:nipy,代码行数:32,代码来源:structural_bfls.py
示例16: test_2d_esmf_conserv
def test_2d_esmf_conserv(self):
print 'running test_2d_esmf_conserv...'
f = cdms2.open(sys.prefix + \
'/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc')
so = f('so')[0, 0, :, :]
clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, :, :]
tic = time.time()
soInterp = so.regrid(clt.getGrid(), regridTool='ESMF', regridMethod='Conservative')
soInterpInterp = soInterp.regrid(so.getGrid(), regridTool='ESMF',
regridMethod='Conservative')
toc = time.time()
print 'time to interpolate (ESMF conservative) forward/backward: ', toc - tic
ntot = reduce(operator.mul, so.shape)
avgdiff = numpy.sum(so - soInterpInterp) / float(ntot)
print 'avgdiff = ', avgdiff
if PLOT:
pylab.figure(2)
pylab.subplot(2, 2, 1)
pylab.pcolor(so, vmin=20.0, vmax=40.0)
pylab.colorbar()
pylab.title('ESMF conserve regrid: so')
pylab.subplot(2, 2, 2)
pylab.pcolor(soInterp, vmin=20.0, vmax=40.0)
pylab.colorbar()
pylab.title('ESMF conserve regrid: soInterp')
pylab.subplot(2, 2, 3)
pylab.pcolor(soInterpInterp, vmin=20.0, vmax=40.0)
pylab.colorbar()
pylab.title('ESMF conserve regrid: soInterpInterp')
pylab.subplot(2, 2, 4)
pylab.pcolor(so - soInterpInterp, vmin=-0.5, vmax=0.5)
pylab.colorbar()
pylab.title('ESMF conserve regrid: error')
开发者ID:NCPP,项目名称:uvcdat-devel,代码行数:34,代码来源:testConserv.py
示例17: fdr
def fdr(p_values=None, verbose=0):
"""Returns the FDR associated with each p value
Parameters
-----------
p_values : ndarray of shape (n)
The samples p-value
Returns
-------
q : array of shape(n)
The corresponding fdr values
"""
p_values = check_p_values(p_values)
n_samples = p_values.size
order = p_values.argsort()
sp_values = p_values[order]
# compute q while in ascending order
q = np.minimum(1, n_samples * sp_values / np.arange(1, n_samples + 1))
for i in range(n_samples - 1, 0, - 1):
q[i - 1] = min(q[i], q[i - 1])
# reorder the results
inverse_order = np.arange(n_samples)
inverse_order[order] = np.arange(n_samples)
q = q[inverse_order]
if verbose:
import matplotlib.pylab as mp
mp.figure()
mp.xlabel('Input p-value')
mp.plot(p_values, q, '.')
mp.ylabel('Associated fdr')
return q
开发者ID:Naereen,项目名称:nipy,代码行数:35,代码来源:empirical_pvalue.py
示例18: viz_docwordfreq_sidebyside
def viz_docwordfreq_sidebyside(P1, P2, title1='', title2='',
vmax=None, aspect=None, block=False):
from matplotlib import pylab
pylab.figure()
if vmax is None:
vmax = 1.0
P1limit = np.percentile(P1.flatten(), 97)
if P2 is not None:
P2limit = np.percentile(P2.flatten(), 97)
else:
P2limit = P1limit
while vmax > P1limit and vmax > P2limit:
vmax = 0.8 * vmax
if aspect is None:
aspect = float(P1.shape[1])/P1.shape[0]
pylab.subplot(1, 2, 1)
pylab.imshow(P1, aspect=aspect, interpolation='nearest', vmin=0, vmax=vmax)
if len(title1) > 0:
pylab.title(title1)
if P2 is not None:
pylab.subplot(1, 2, 2)
pylab.imshow(P2, aspect=aspect, interpolation='nearest', vmin=0, vmax=vmax)
if len(title2) > 0:
pylab.title(title2)
pylab.show(block=block)
开发者ID:agile-innovations,项目名称:refinery,代码行数:27,代码来源:BirthMoveTopicModel.py
示例19: check_isometry
def check_isometry(G, chart, nseeds=100, verbose = 0):
"""
A simple check of the Isometry:
look whether the output distance match the intput distances
for nseeds points
Returns
-------
a scaling factor between the proposed and the true metrics
"""
nseeds = np.minimum(nseeds, G.V)
aux = np.argsort(nr.rand(nseeds))
seeds = aux[:nseeds]
dY = Euclidian_distance(chart[seeds],chart)
dx = G.floyd(seeds)
dY = np.reshape(dY,np.size(dY))
dx = np.reshape(dx,np.size(dx))
if verbose:
import matplotlib.pylab as mp
mp.figure()
mp.plot(dx,dY,'.')
mp.show()
scale = np.dot(dx,dY)/np.dot(dx,dx)
return scale
开发者ID:Garyfallidis,项目名称:nipy,代码行数:27,代码来源:dimension_reduction.py
示例20: show
def show(self, rescale=True, ax=None):
"""Visualization of a design matrix
Parameters
----------
rescale: bool, optional
rescale columns magnitude for visualization or not
ax: figure handle, optional
Returns
-------
ax, figure handle
"""
x = self.matrix.copy()
if rescale:
x = x / np.sqrt(np.sum(x ** 2, 0))
import matplotlib.pylab as mp
if ax is None:
mp.figure()
ax = mp.subplot(1, 1, 1)
ax.imshow(x, interpolation='Nearest', aspect='auto')
ax.set_label('conditions')
ax.set_ylabel('scan number')
if self.names is not None:
ax.set_xticks(range(len(self.names)))
ax.set_xticklabels(self.names, rotation=60, ha='right')
return ax
开发者ID:FNNDSC,项目名称:nipy,代码行数:30,代码来源:design_matrix.py
注:本文中的matplotlib.pylab.figure函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论