本文整理汇总了Python中matplotlib.pylab.tick_params函数的典型用法代码示例。如果您正苦于以下问题:Python tick_params函数的具体用法?Python tick_params怎么用?Python tick_params使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tick_params函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: plot_bar_FeOx
def plot_bar_FeOx():
# FeOx
df = pd.read_csv('../results/dynamic_results/FeOx_vintage_results_0226.csv',index_col=[0,1])
market_name = ['Household & Furniture','Automotive','Medical','Other Industries','Packaging','Electronics',
'Construction & Building']
amount=[df.loc[mat,'Manufacturing Release']['2010.0']+df.loc[mat,'In Use']['2010.0']+df.loc[mat,'End of Life']['2010.0'] for mat in market_name]
width = 0.15
last_num = 0
color=iter(cm.Set1(np.linspace(0,1,7)))
for name,num in zip(market_name,amount):
c=next(color)
if name == 'Construction & Building':
plt.bar(0.1,num,width,bottom=last_num,color=c,label=name,yerr=1000,error_kw=dict(ecolor='rosybrown', lw=2, capsize=5, capthick=2))
else:
plt.bar(0.1,num,width,bottom=last_num,color=c,label=name)
last_num += num
plt.bar(0.7,13860,width,color='salmon',label = 'Static Results (aggregated, all uses)')
plt.legend(loc='upper left')
plt.xlim(0,1)
plt.xticks((0.18,0.78), ('Dynamic Model','Static Model'))
plt.tick_params(labelsize=14)
plt.show()
开发者ID:RunshengSong,项目名称:vintage_model,代码行数:25,代码来源:bar_plot.py
示例2: gen_plot
def gen_plot(processes,filename):
fig = plt.figure(figsize=(10,10))
ax = fig.add_subplot(111)
c = Counter(processes).items()
c.sort(key=itemgetter(1))
c.reverse()
#c=c[1:]
#c=c[:len(c)/2]
labels, values = zip(*c)
ll=[]
for i in labels:
if not (i[0] == '['):
ll.append(i.split('/')[-1])
else:
ll.append(i)
print labels
print "------"
print ll
indexes = np.arange(len(labels))
width = 0.5
ax.bar(indexes, values, width)
plt.xticks(indexes+width*0.5 , ll, rotation=90)
plt.tick_params(axis='both', which='major', labelsize=10)
plt.savefig(filename+'.pdf')
开发者ID:abnarain,项目名称:malware_detection,代码行数:26,代码来源:parser.py
示例3: showStaticImage
def showStaticImage(request, che_str):
import matplotlib
matplotlib.use('Agg')
import matplotlib.pylab as plt
plt.style.use('ggplot')
# change type depending on what's in che_string
if 'R' in che_str:
RR = RTG_Read_Rate
elif 'T' in che_str:
RR = FEL_Read_Rate
# create seperate lists for the dates and the read rates
fel_list = che_str.split('+')
for fel in fel_list:
dates = [] # List for storing dates (x axis)
results = [] # List for storing dictionaries for read rates
for i in RR.objects.filter(che_id=fel).order_by('date'):
dates.append(i.date)
results.append(i.read_rate)
# Configure the plots for each iteration
plt.plot(dates, results, '-o', linewidth=1, label=fel)
plt.xticks(rotation=35)
plt.tick_params(axis='both', labelsize=8)
plt.ylim(0, 1.0)
plt.legend(loc='lower left', fontsize='8')
response = HttpResponse(content_type='image/png')
plt.savefig(response, format='png', dpi=96*1.5)
plt.close()
return response
开发者ID:brsgr,项目名称:apmt-tech-dashboard,代码行数:29,代码来源:views.py
示例4: plotRocCurves
def plotRocCurves(file_legend):
pylab.clf()
pylab.figure(1)
pylab.xlabel('1 - Specificity', fontsize=12)
pylab.ylabel('Sensitivity', fontsize=12)
pylab.title("Need for Referral")
pylab.grid(True, which='both')
pylab.xticks([i/10.0 for i in range(1,11)])
pylab.yticks([i/10.0 for i in range(0,11)])
pylab.tick_params(axis="both", labelsize=15)
for file, legend in file_legend:
points = open(file,"rb").readlines()
x = [float(p.split()[0]) for p in points]
y = [float(p.split()[1]) for p in points]
dev = [float(p.split()[2]) for p in points]
x = [0.0] + x
y = [0.0] + y
dev = [0.0] + dev
auc = np.trapz(y, x) * 100
aucDev = np.trapz(dev, x) * 100
pylab.grid()
pylab.errorbar(x, y, yerr = dev, fmt='-')
pylab.plot(x, y, '-', linewidth = 1.5, label = legend + u" (AUC = {0:0.1f}% \xb1 {1:0.1f}%)".format(auc,aucDev))
pylab.legend(loc = 4, borderaxespad=0.4, prop={'size':12})
pylab.savefig("referral/referral-curves.pdf", format='pdf')
开发者ID:piresramon,项目名称:retina.bovw.plosone,代码行数:29,代码来源:referral.py
示例5: plot_spectrograms
def plot_spectrograms(bsl,rec,rate,y,ax):
ny_nfft=1024
i=7
plt.tick_params(axis='both', labelsize=8)
Pxx, freq, bins, im = ax[y,0].specgram(bsl[i],NFFT=ny_nfft,Fs=rate)
ax[y,0].set_yticks(np.arange(0, 50, 10))
ax[y,0].set_ylim([0, 40])
if(y==3):
ax[y,0].set_xlabel("Time, seconds", fontsize=10)
ax[y,0].set_ylabel("Freq, Hz", fontsize=8)
ax[y,0].set_title('Subject '+str(y+1)+' Baseline', fontsize=10)
for label in (ax[y,0].get_xticklabels() + ax[y,0].get_yticklabels()):
label.set_fontname('Arial')
label.set_fontsize(8)
Pxx, freq, bins, im = ax[y,1].specgram(rec[i],NFFT=ny_nfft,Fs=rate)
ax[y,0].set_yticks(np.arange(0, 50, 10))
ax[y,1].set_ylim([0, 40])
#ax[i,1].set_xlim([0, 10000]) #13000])
if(y==3):
ax[y,1].set_xlabel("Time, seconds", fontsize=10)
#ax[i,1].set_ylabel("Freq, Hz")
ax[y,1].set_title('Subject '+str(y+1)+' Recovery', fontsize=10)
for label in (ax[y,0].get_xticklabels() + ax[y,0].get_yticklabels()):
label.set_fontname('Arial')
label.set_fontsize(8)
return
开发者ID:END-team,项目名称:final-project,代码行数:30,代码来源:feature_comparison.py
示例6: plot_integrated_colors
def plot_integrated_colors(filenames, labels='Z'):
if type(filenames) is str:
filenames = [filenames]
ax = None
cols = ['k']
else:
fig, ax = plt.subplots()
cols = brewer2mpl.get_map('Spectral', 'Diverging',
len(filenames)).mpl_colors
if labels == 'Z':
fmt = '$Z=%.4f$'
labels = [fmt % float(l.replace('.dat', '').split('Z')[1])
for l in filenames]
else:
print 'need to fix labels'
labels = [''] * len(filenames)
for i, filename in enumerate(filenames):
data = rsp.fileIO.readfile(filename)
ycol = 'V-K'
xcol = 'Age'
ax = rg.color_color(data, xcol, ycol, xscale='log', ax=ax,
plt_kw={'lw': 2, 'color': cols[i],
'label': labels[i]})
plot_cluster_data(ax)
ax.legend(frameon=False, loc=0, numpoints=1)
ax.set_xlabel(r'${\rm %s}$' % xcol, fontsize=20)
ax.set_ylabel(r'${\rm %s}$' % ycol, fontsize=20)
plt.tick_params(labelsize=16)
return ax
开发者ID:philrosenfield,项目名称:TPAGB-calib,代码行数:31,代码来源:integrated_colors.py
示例7: corr
def corr(data,labels,**kwargs):
data=np.transpose(data)
corrs=np.corrcoef(data)
labelsDict=dict((i,labels[i]) for i in range(len(labels)))
if 'makeGraph' in kwargs.keys():
if kwargs['makeGraph']==True:
fig,ax=plt.subplots()
# plt.pcolor(corrs)
plt.pcolor(corrs>=kwargs['Tresh'])
plt.xticks([i for i in range(44)],rotation=45)
ax.set_xticklabels(labels)
ax.set_yticklabels(labels)
plt.tick_params(axis='both', which='both', labelsize=7)
# plt.imshow(corrs>=kwargs['Tresh'],interpolation=None)
# plt.colorbar()
plt.show()
if 'undGraph' in kwargs:
plt.figure()
if kwargs['undGraph']==True:
gcorrs=np.copy(corrs)
if 'Tresh' in kwargs:
idx=np.where(corrs<=kwargs['Tresh'])
gcorrs[idx]=0
gcorrs=gcorrs-np.identity(gcorrs.shape[0])
G=nx.from_numpy_matrix(np.triu(gcorrs))
for node in nx.nodes(G):
edges=np.sum([ 1 for i in nx.all_neighbors(G, node)])
if edges==0:
G.remove_node(node)
labelsDict.pop(node)
G=nx.relabel_nodes(G,labelsDict)
pos=nx.spring_layout(G,iterations=200)
# pos=nx.shell_layout(G)
nx.draw_networkx(G,pos,font_size=9)
# nx.draw_spring(G)
# nx.draw(G,pos,font_size=9)
plt.show()
if 'ret' in kwargs.keys():
if kwargs['ret']==True:
corrs2=np.triu(corrs-np.diagflat(np.diag(corrs)))
i,j=np.where(np.abs(corrs2)>=kwargs['Tresh'])
# print corrs2[i,j]
# print i
# print j
feats=set(list(i)+list(j))
# print feats
return feats
开发者ID:julian-ramos,项目名称:kindsOfUsers,代码行数:57,代码来源:viz.py
示例8: plot
def plot(a,fileig,Q,point_names,ef=0,fildos=None,ymin=None,ymax=None
,pdos_pref=None,atoms=None,pdos_max=None):
"""docstring for plot"""
fig = plt.figure(0,(12, 8))
assert len(Q) == len(point_names), "Length of Q and point_names should be the same!"
if fildos != None:
ax = plt.axes([.06, .05, .7, .85])
ef,e,dos = dos_reader(fildos)
e -= ef
elif pdos_pref:
ax = plt.axes([.06, .05, .7, .85])
else:
ax = fig.add_subplot(111)
eig,kpts = eig_reader(fileig)
eig -= ef
q = kline(kpts,a)
for i in xrange(eig.shape[1]):
plt.plot(q,eig[:,i],'k-',lw=1)
plt.xticks(q[Q], point_names)
plt.tick_params(axis='x', labeltop='on',labelsize=15,labelbottom='off')
plt.yticks(fontsize=15)
plt.xlim(q[0], q[-1])
plt.plot(q,[0]*len(q),'r--')
plt.xlabel("Reduced wave number", fontsize=18)
plt.ylabel("Electron Energy (eV)", fontsize=18)
plt.grid('on')
plt.ylim(ymin,ymax)
ymin,ymax = plt.ylim()
# add an extra ef on the right of the axis.... so troublesome
# ax1 = plt.axes([.11, .05, .64, .85],frameon=False)
ax1 = plt.axes(ax.get_position(),frameon=False)
ax1.yaxis.tick_right()
# plt.tick_params(axis='y', labelleft='on',labelright='on',labelsize=15)
ax1.xaxis.set_ticklabels([])
ax1.xaxis.set_ticks_position('none')
plt.yticks([0],['$\epsilon_{\mathrm{F}}$'],fontsize=15)
plt.ylim(ymin,ymax)
if fildos:
plt.axes([.79, .05, 0.20, .85])
plt.plot(dos,e,'k-',lw=1)
plt.ylim(ymin,ymax)
plt.xticks([],[])
plt.yticks([],[])
plt.xlabel("DOS",fontsize=18)
if pdos_pref:
ax2 = plt.axes([.79, .05, 0.20, .85])
plot_pdos(pdos_pref,atoms,ax=ax2)
ax2.set_xticks([],[])
ax2.set_yticks([],[])
ax2.set_ylim(ymin,ymax)
ax2.set_xlim(0,pdos_max)
plt.show()
plt.close()
开发者ID:xiahongze,项目名称:dft-tools-mods,代码行数:56,代码来源:abplotter.py
示例9: plot_autocorrs
def plot_autocorrs(self, axis=0, n_rows=4, n_cols=8):
""" Plot autocorrelations for all antennas
"""
self.current_plot = 'multi'
self.ax_zoomed = False
bls = self.uv.d_uv_data['BASELINE']
# Extract the relevant baselines using a truth array
# bls = bls.tolist()
bl_ids = set([256*i + i for i in range(1, n_rows * n_cols + 1)])
bl_truths = np.array([(b in bl_ids) for b in bls])
#print self.uv.d_uv_data['DATA'].shape
#x_data = self.d_uv_data['DATA'][bl_truths,0,0,:,0,axis] # Baselines, freq and stokes
#x_cplx = x_data[:,:,0] + 1j * x_data[:,:,1]
x_cplx = self.stokes[axis][bl_truths]
# Plot the figure
#print self.uv.n_ant
fig = self.sp_fig
figtitle = '%s %s: %s -- %s'%(self.uv.telescope, self.uv.instrument, self.uv.source, self.uv.date_obs)
for i in range(n_rows):
for j in range(n_cols):
ax = fig.add_subplot(n_rows, n_cols, i*n_cols + j +1)
ax.set_title(self.uv.d_array_geometry['ANNAME'][i*n_cols + j], fontsize=10)
#ax.set_title("%s %s"%(i, j))
x = x_cplx[i*n_cols+j::self.uv.n_ant]
if self.scale_select.currentIndex() == 0 or self.scale_select.currentIndex() == 1:
if x.shape[0] == self.uv.n_ant:
self.plot_spectrum(ax, x, label_axes=False)
else:
self.plot_spectrum(ax, x, stat='max', label_axes=False)
self.plot_spectrum(ax, x, stat='med', label_axes=False)
self.plot_spectrum(ax, x, stat='min', label_axes=False)
else:
self.plot_spectrum(ax, x, label_axes=False)
self.updateFreqAxis(ax)
if i == n_rows-1:
ax.set_xlabel('Freq')
if j == 0:
ax.set_ylabel('Amplitude')
plt.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
plt.tick_params(axis='both', which='major', labelsize=10)
plt.tick_params(axis='both', which='minor', labelsize=8)
plt.xticks(rotation=30)
plt.subplots_adjust(left=0.05, right=0.98, top=0.95, bottom=0.1, wspace=0.3, hspace=0.45)
return fig, ax
开发者ID:jaycedowell,项目名称:interfits,代码行数:56,代码来源:qtuv.py
示例10: plot_density
def plot_density(self, vector, coords, max_el=1.0, min_el=0.0, **kwrds):
maxel = max_el*np.max(vector)
minel = min_el*np.max(vector)
print maxel, minel
xmin = 0.0
xmax = 0.0
ymin = 0.0
ymax = 0.0
for i in xrange(len(vector)):
if maxel != minel:
msize = vector[i] * 180. / np.sqrt(np.sqrt(len(vector))) / (maxel-minel)
#R = 1/(maxel) * (density1d[i].real)
#G = 1/(maxel) * (maxel - density1d[i].real)
if vector[i] >= maxel:
R = 1
G = 0
elif vector[i] <= minel:
G = 1
R = 0
else:
R = 0.999 / (maxel - minel) * (vector[i].real - minel)
G = 0.999 / (maxel - minel) * (maxel - vector[i].real)
B = 0.0
else:
msize = 0.0
R = 0.0
G = 0.0
B = 0.0
plt.plot(coords[i][0], coords[i][1], 'o', mfc='k', ms=2)
plt.plot(coords[i][0], coords[i][1], 'o', mfc=(R,G,B), ms=msize, **kwrds)
if coords[i][0] < xmin:
xmin = coords[i][0]
elif coords[i][0] > xmax:
xmax = coords[i][0]
elif coords[i][1] < ymin:
ymin = coords[i][0]
elif coords[i][1] > ymax:
ymax = coords[i][1]
dx = (xmax-xmin) / 10.
dy = (ymax-ymin) / 10.
plt.xlim(xmin - 0.5*dx, xmax + 0.5*dx)
plt.ylim(ymin - 0.5*dy, ymax + 0.5*dy)
plt.xlabel(r'$x$', fontsize = 26)
plt.ylabel(r'$y$', fontsize = 26)
plt.tick_params(labelsize=22)
#plt.axes().set_aspect('equal')
return None
开发者ID:zonksoft,项目名称:envTB,代码行数:56,代码来源:plotter.py
示例11: plot_matrix
def plot_matrix(data):
plt.tick_params(
axis='both', which='both', labelleft='off',
bottom='off', top='off', labelbottom='off', left='off', right='off')
plt.imshow(
data,
interpolation='nearest', cmap=get_matrix_cmap(),
vmin=0, vmax=3)
plt.colorbar(ticks=range(np.max(data)+1), extend='min')
开发者ID:kpj,项目名称:SDEMotif,代码行数:10,代码来源:network_matrix.py
示例12: violin_plot
def violin_plot(ax, values_list, measure_name, group_names, fontsize, color='blue', ttest=False):
'''
This is a little wrapper around the statsmodels violinplot code
so that it looks nice :)
'''
# IMPORTS
import matplotlib.pylab as plt
import statsmodels.api as sm
import numpy as np
# Make your violin plot from the values_list
# Don't show the box plot because it looks a mess to be honest
# we're going to overlay a boxplot on top afterwards
plt.sca(ax)
# Adjust the font size
font = { 'size' : fontsize}
plt.rc('font', **font)
max_value = np.max(np.concatenate(values_list))
min_value = np.min(np.concatenate(values_list))
vp = sm.graphics.violinplot(values_list,
ax = ax,
labels = group_names,
show_boxplot=False,
plot_opts = { 'violin_fc':color ,
'cutoff': True,
'cutoff_val': max_value,
'cutoff_type': 'abs'})
# Now plot the boxplot on top
bp = plt.boxplot(values_list, sym='x')
for key in bp.keys():
plt.setp(bp[key], color='black', lw=fontsize/10)
# Adjust the power limits so that you use scientific notation on the y axis
plt.ticklabel_format(style='sci', axis='y')
ax.yaxis.major.formatter.set_powerlimits((-3,3))
plt.tick_params(axis='both', which='major', labelsize=fontsize)
# Add the y label
plt.ylabel(measure_name, fontsize=fontsize)
# And now turn off the major ticks on the y-axis
for t in ax.yaxis.get_major_ticks():
t.tick1On = False
t.tick2On = False
return ax
开发者ID:KirstieJane,项目名称:DESCRIBING_DATA,代码行数:52,代码来源:create_violin_plots.py
示例13: draw_gene_isoforms
def draw_gene_isoforms(D, gene_id, outfile, outfmt):
import matplotlib.patches as mpatches;
from matplotlib.collections import PatchCollection;
ISO = D[_.orig_gene == gene_id].GroupBy(_.alt_gene).Without(_.orig_gene, _.orig_exon_start, _.orig_exon_end).Sort(_.alt_gene);
plt.cla();
y_loc = 0;
y_step = 30;
n_iso = ISO.alt_gene.Shape()();
origins = np.array([ [0, y] for y in xrange((y_step * (n_iso+1)),n_iso,-y_step) ]);
patch_h = 10;
xlim = [ ISO.exon_start.Min().Min()(), ISO.exon_end.Max().Max()()];
ylim = [ y_step, (y_step * (n_iso+1)) + 2*patch_h];
patches = [];
for (origin, alt_id, starts, ends, exons, retention, alt5, alt3, skipped, new, ident) in zip(origins, *ISO()):
plt.gca().text( min(starts), origin[1] + patch_h, alt_id, fontsize=10);
for (exon_start, exon_end, exon_coverage, exon_retention, exon_alt5, exon_alt3, exon_skipped, exon_new, exon_ident) in zip(starts, ends, exons, retention, alt5, alt3, skipped, new, ident):
if not(exon_skipped):
patch = mpatches.FancyBboxPatch(origin + [ exon_start, 0], exon_end - exon_start, patch_h, boxstyle=mpatches.BoxStyle("Round", pad=0), color=draw_gene_isoforms_color(exon_retention, exon_alt5, exon_alt3, exon_skipped, exon_new, exon_ident));
text_x, text_y = origin + [ exon_start, +patch_h/2];
annots = zip(['Retention', "Alt 5'", "Alt 3'", "Skipped", 'New'], [exon_retention, exon_alt5, exon_alt3, exon_skipped, exon_new]);
text = '%s: %s' %( ','.join([str(exid) for exid in exon_coverage]), '\n'.join([ s for (s,b) in annots if b]));
plt.gca().text(text_x, text_y, text, fontsize=10, rotation=-45);
plt.gca().add_patch(patch);
if all(ident):
plt.gca().plot([exon_start, exon_start], [origin[1], 0], '--k', alpha=0.3);
plt.gca().plot([exon_end, exon_end], [origin[1], 0], '--k', alpha=0.3);
#fi
#fi
#efor
#efor
plt.xlim(xlim);
plt.ylim(ylim);
plt.title('Isoforms for gene %s' % gene_id);
plt.xlabel('Location on chromosome');
plt.gca().get_yaxis().set_visible(False);
plt.gca().spines['top'].set_color('none');
plt.gca().spines['left'].set_color('none');
plt.gca().spines['right'].set_color('none');
plt.tick_params(axis='x', which='both', top='off', bottom='on');
plt.savefig(outfile, format=outfmt);
return ISO;
开发者ID:WenchaoLin,项目名称:delftrnaseq,代码行数:52,代码来源:splicing_statistics.py
示例14: plot_pop_size_across_time
def plot_pop_size_across_time(params,
ymin=ymin,
ymax=ymax):
offset = step_size / 250.
num_xticks = 11
ax = sns.tsplot(time="t", value="log2_pop_size", unit="sim_num",
condition="policy", color=policy_colors,
err_style="ci_band",
ci=95,
data=df,
legend=False)
for policy_num, policy in enumerate(policy_colors):
error_df = summary_df[summary_df["policy"] == policy]
c = policy_colors[policy]
assert (len(error_df["t"]) == len(time_obj.t) == \
len(error_df["log2_pop_size"]["mean"]))
plt.xlabel("Time step", fontsize=10)
plt.ylabel("Pop. size ($\log_{2}$)", fontsize=10)
# assuming glucose is listed first
gluc_growth_rate = params["nutr_growth_rates"][0]
galac_growth_rate = params["nutr_growth_rates"][1]
if title is not None:
plt.title(title, fontsize=8)
else:
plt.title(r"$P_{0} = %d$, " \
r"$\mu_{\mathsf{Glu}} = %.2f, \mu_{\mathsf{Gal}} = %.2f$, " \
r"$\mu_{\mathsf{Mis}} = %.2f$, lag = %d, " \
r"%d iters" %(init_pop_size,
gluc_growth_rate,
galac_growth_rate,
params["mismatch_growth_rate"],
params["decision_lag_time"],
params["num_sim_iters"]),
fontsize=8)
c = 0.5
plt.xlim([min(df["t"]) - c, max(df["t"]) + c])
if ymin is None:
ymin = int(np.log2(init_pop_size))
plt.ylim(ymin=ymin)
plt.xlim([time_obj.t.min(),
time_obj.t.max()])
plt.xticks(range(int(time_obj.t.min()), int(time_obj.t.max()) + x_step,
x_step),
fontsize=8)
if yticks is not None:
plt.yticks(yticks, fontsize=8)
plt.ylim(yticks[0], yticks[-1])
sns.despine(trim=True, offset=2*time_obj.step_size)
plt.tick_params(axis='both', which='major', labelsize=8,
pad=2)
开发者ID:yarden,项目名称:paper_metachange,代码行数:50,代码来源:model_switch_ssm.py
示例15: plot_bar_plot
def plot_bar_plot(entropy_rates, filename, y_label):
def_font_size = matplotlib.rcParams['font.size']
matplotlib.rcParams.update({'font.size': 25})
# entropy_rates = entropy_rates.T
f, ax = plt.subplots(figsize=(20, 8))
hatch = ['-', 'x', '\\', '*', 'o', 'O', '.', '/'] * 2
#symbols = ['$\\clubsuit$', '$\\bigstar$', '$\\diamondsuit$', '$\\heartsuit', '$\\spadesuit$', '$\\blacksquare$']
symbols = ['O', 'E', 'D', 'I', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M']
colors = ['blue', 'green', 'red', 'black', 'magenta', 'orange', 'gray'] * 2
num_ds = len(entropy_rates.columns)
num_ticks = len(entropy_rates)
width = 0.7
dataset_offset = width / num_ds
space = 0.02
rects = list()
for idx, (i, h, c, s) in enumerate(zip(entropy_rates.columns, hatch, colors, symbols)):
pos = 0. - (width / 2) + idx * dataset_offset + idx * (space/2)
pos = np.array([pos + idx for idx in xrange(num_ticks)])
# print idx, step, width
#print pos
#print width
#print i
rects.append(
ax.bar(pos, entropy_rates[i], (width / num_ds - space), color='white', label=s + ': ' + i.decode('utf8'),
lw=2, alpha=1., hatch=h, edgecolor=c))
autolabel(s, pos + (width / num_ds - space) / 2, entropy_rates[i], ax)
# ax = entropy_rates[i].plot(position=pos,width=0.8, kind='bar',rot=20,ax=ax, alpha=1,lw=0.4,hatch=h,color=c)
ax.set_position([0.1, 0.2, .8, 0.6])
plt.xticks(np.array(range(len(entropy_rates))), entropy_rates.index, rotation=0)
ax.set_axisbelow(True)
ax.xaxis.grid(False)
ax.yaxis.grid(True, linewidth=3, alpha=0.2, ls='--')
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['bottom'].set_visible(False)
ax.spines['left'].set_visible(False)
plt.tick_params(labelright=True)
plt.legend(ncol=2, loc='upper center', bbox_to_anchor=(0.5, 1.35))
plt.ylim([min(list(entropy_rates.min())) * .95, max(list(entropy_rates.max())) * 1.05])
plt.ylabel(y_label)
# plt.subplots_adjust(top=0.7)
# plt.tight_layout()
plt.savefig(filename, bbox_tight=True)
plt.close('all')
os.system('pdfcrop ' + filename + ' ' + filename)
# plt.show()
matplotlib.rcParams.update({'font.size': def_font_size})
开发者ID:floriangeigl,项目名称:RandomSurfers,代码行数:48,代码来源:plotting.py
示例16: draw_out_put_digit
def draw_out_put_digit(data, n, ans, recog):
"""
学習済みのモデルが判定した画像を描画します.
@param data 画像データ
@param n 画像の通し番号
@param ans 正解ラベル
@param recog 推定した数字
"""
plt.subplot(10, 10, n)
Z = data.reshape(SIZE, SIZE)
Z = Z[::-1, :]
plt.xlim(0, 27)
plt.ylim(0, 27)
plt.pcolor(Z)
plt.title('ans=%d, recog=%d' % (ans, recog), size=8)
plt.gray()
plt.tick_params(labelbottom='off')
plt.tick_params(labelleft='off')
开发者ID:m-yamagishi,项目名称:yamagit,代码行数:18,代码来源:mnist_util.py
示例17: writeImage
def writeImage(fs, data, path):
# 画像生成
# fs, data = read(WAVE_OUTPUT_FILENAME)
cq_spec, freqs = cq_fft(data, fs)
w, h = cq_spec.shape
fig = pl.figure()
fig.add_subplot(111)
pl.imshow(abs(cq_spec).T, aspect = "auto", origin = "lower")
pl.tick_params(labelbottom='off')
pl.tick_params(labelleft='off')
filepath = path + '/img.png'
pl.savefig(filepath, bbox_inches='tight')
# dumpを保存
raw_filepath = path + '/data.pkl'
f = open(raw_filepath, 'w')
pickle.dump(cq_spec, f)
f.close()
开发者ID:computational-science-of-art,项目名称:suikin,代码行数:18,代码来源:processing.py
示例18: plot_market_vintage
def plot_market_vintage(self,args='Total Release'):
'''
Function to plot out the vintage results by markets
This verion is going to plot out graph depending on the input arguments
Total Release (defult): will plot out the total release (end of life + in use) for each market
End of Life: will plot out the end of life release for each market
'''
color=iter(cm.Set1(np.linspace(0,1,7)))
if args == 'Total Release':
fig,ax = plt.subplots(1)
for each_mak, each_val in self.market_vintage_results.iteritems():
c=next(color)
this_tot_release = each_val['Manufacturing Release']+each_val['In Use']+ each_val['End of Life']
ax.plot(self.years, this_tot_release,label = each_mak, linewidth = 2.5,c=c)
#order legend
handles, labels = ax.get_legend_handles_labels()
handles = [handles[6],handles[0],handles[2],handles[3],handles[4],handles[5],handles[1]]
labels = [labels[6], labels[0], labels[2],labels[3],labels[4],labels[5],labels[1]]
ax.legend(handles,labels,loc='upper left')
plt.xlabel('Year', fontsize=20, fontweight='bold')
plt.ylabel('Total Releases in Tons', fontsize=20, fontweight='bold')
plt.tick_params(labelsize=14)
plt.show()
elif args =='End of Life':
plt.figure()
for each_mak, each_val in self.market_vintage_results.iteritems():
plt.plot(self.years, each_val['End of Life'],label = each_mak)
plt.legend(loc ='upper left')
plt.xlabel('Year', fontsize=20, fontweight='bold')
plt.ylabel('End of Life Releases in Tonnes', fontsize=20, fontweight='bold')
plt.show()
elif args =='In Use':
plt.figure()
for each_mak, each_val in self.market_vintage_results.iteritems():
plt.plot(self.years, each_val['In Use'],label = each_mak)
plt.legend(loc ='upper left')
plt.xlabel('Year', fontsize=20, fontweight='bold')
plt.ylabel('In Use Releases in Tonnes', fontsize=20, fontweight='bold')
plt.show()
开发者ID:RunshengSong,项目名称:vintage_model,代码行数:42,代码来源:vintage_model.py
示例19: draw_field
def draw_field(bkx,bky,whx,why,bkhx,bkhy,whhx,whhy):
fig=plt.figure()
field=fig.add_subplot(111)
plt.scatter(bkhx,bkhy,c='blue',s=50)
plt.scatter(whhx,whhy,c='red',s=50)
plt.scatter(bkx,bky,c='black',s=300)
plt.scatter(whx,why,c='grey',s=300)
plt.grid()
plt.xlim(0,goban)
plt.ylim(0,goban)
plt.yticks(range(0,goban))
plt.xticks(np.array(range(0,goban)),alphabetU)
field.set_xticklabels([])
field.set_yticklabels([])
field.xaxis.set_minor_locator(plt.FixedLocator(xtcks))
field.xaxis.set_minor_formatter(plt.FixedFormatter(alphabetU))
field.yaxis.set_minor_locator(plt.FixedLocator(ytcks))
field.yaxis.set_minor_formatter(plt.FixedFormatter(range(0,goban+1)))
plt.tick_params(axis="x",which="minor",bottom="on",top="on")
plt.show()
开发者ID:Serkora,项目名称:kamiken,代码行数:20,代码来源:kamiken+copy.py
示例20: plot_rmsd
def plot_rmsd(time,rmsd_backbone, rmsd_ligand):
print('Plotting')
fig = pl.figure( figsize =(50,10) )
print(str(len(rmsd_backbone)))
print(str(len(rmsd_ligand)))
print(str( len(time)))
ax1 = fig.add_subplot(121)
ax1.plot(time, rmsd_backbone, 'b-', label="backbone")
ax1.plot(time, rmsd_ligand, 'r-', label="ligand")
pl.xlabel(fig, fontsize=40)
pl.ylabel(fig, fontsize=40)
pl.tick_params(axis='both', which='major', labelsize=30)
pl.tick_params(axis='both', which='minor', labelsize=30)
ax1.legend(loc="best", fontsize=30)
ax1.set_xlabel("time (ps)", fontsize=40)
ax1.set_ylabel(r"RMSD ($\AA$)", fontsize=40)
pl.rcParams.update({'font.size': 22})
ax1.set_title("RMSD vs time-step of backbone and ligand", fontsize=40)
pl.show()
开发者ID:Guillopflaume,项目名称:phanalysis,代码行数:21,代码来源:md_analysis.py
注:本文中的matplotlib.pylab.tick_params函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论