本文整理汇总了Python中matplotlib.pylab.yticks函数的典型用法代码示例。如果您正苦于以下问题:Python yticks函数的具体用法?Python yticks怎么用?Python yticks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了yticks函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: ca_box_plot_shopping
def ca_box_plot_shopping():
# 读取数据
data1 = pd.read_csv('data/split_class/large_IGNORE_425_shopping_+1.txt', sep=' ', header=None)
data2 = pd.read_csv('data/split_class/large_IGNORE_425_shopping_-1.txt', sep=' ', header=None)
col1 = data1[2] / data1[1]
col2 = data2[2] / data2[1]
# print(col1.describe())
# print(col2.describe())
# col1.to_csv("shopping_+1.txt")
# col2.to_csv("shopping_-1.txt")
plt.figure(figsize=(8, 4))
sns.boxplot(data=[col1, col2], fliersize=0.1, width=0.3)
# sns.violinplot(data=[col1, col2], fliersize=0.1, width=0.3)
plt.xticks((0, 1), ('Extroverts', 'Introverts'), fontsize=20)
# plt.xlim(0.5, 2.5)
plt.yticks(fontsize=20)
plt.ylabel("Purchasing Index", fontsize=20)
plt.ylim(0, 0.12)
# plt.boxplot(data=[col1, col2], vert=False, sym='k+', showmeans=True, showfliers=True, notch=1)
# plt.yticks((1, 2), ('Extroverts', 'Introverts'), fontsize=25, rotation=30)
# plt.ylim(0.5, 2.5)
#
# plt.xticks(fontsize=30)
# plt.xlabel("Purchasing Index", fontsize=30)
# plt.xlim(0, 0.12)
plt.savefig('figure/purchase_box.eps', dpi=300)
plt.show()
开发者ID:kayzhou,项目名称:character_analysis,代码行数:30,代码来源:paint.py
示例2: 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
示例3: plot_svc
def plot_svc(X, y, mysvc, bounds=None, grid=50):
if bounds is None:
xmin = np.min(X[:, 0], 0)
xmax = np.max(X[:, 0], 0)
ymin = np.min(X[:, 1], 0)
ymax = np.max(X[:, 1], 0)
else:
xmin, ymin = bounds[0], bounds[0]
xmax, ymax = bounds[1], bounds[1]
aspect_ratio = (xmax - xmin) / (ymax - ymin)
xgrid, ygrid = np.meshgrid(np.linspace(xmin, xmax, grid),
np.linspace(ymin, ymax, grid))
plt.gca(aspect=aspect_ratio)
plt.xlim(xmin, xmax)
plt.ylim(ymin, ymax)
plt.xticks([])
plt.yticks([])
plt.hold(True)
plt.plot(X[y == 1, 0], X[y == 1, 1], 'bo')
plt.plot(X[y == -1, 0], X[y == -1, 1], 'ro')
box_xy = np.append(xgrid.reshape(xgrid.size, 1), ygrid.reshape(ygrid.size, 1), 1)
if mysvc is not None:
scores = mysvc.decision_function(box_xy)
else:
print 'You must have a valid SVC object.'
return None;
CS=plt.contourf(xgrid, ygrid, scores.reshape(xgrid.shape), alpha=0.5, cmap='jet_r')
plt.contour(xgrid, ygrid, scores.reshape(xgrid.shape), levels=[0], colors='k', linestyles='solid', linewidths=1.5)
plt.contour(xgrid, ygrid, scores.reshape(xgrid.shape), levels=[-1,1], colors='k', linestyles='dashed', linewidths=1)
plt.plot(mysvc.support_vectors_[:,0], mysvc.support_vectors_[:,1], 'ko', markerfacecolor='none', markersize=10)
CB = plt.colorbar(CS)
开发者ID:feuerchop,项目名称:IndicativeSVC,代码行数:33,代码来源:utils.py
示例4: plot
def plot(W, idx2term):
"""
Plot the interpretation of NMF basis vectors on Medlars data set.
:param W: Basis matrix of the fitted factorization model.
:type W: `scipy.sparse.csr_matrix`
:param idx2term: Index-to-term translator.
:type idx2term: `dict`
"""
print "Plotting highest weighted terms in basis vectors ..."
for c in xrange(W.shape[1]):
if sp.isspmatrix(W):
top10 = sorted(enumerate(W[:, c].todense().ravel().tolist()[0]), key = itemgetter(1), reverse = True)[:10]
else:
top10 = sorted(enumerate(W[:, c].ravel().tolist()[0]), key = itemgetter(1), reverse = True)[:10]
pos = np.arange(10) + .5
val = zip(*top10)[1][::-1]
plb.figure(c + 1)
plb.barh(pos, val, color = "yellow", align = "center")
plb.yticks(pos, [idx2term[idx] for idx in zip(*top10)[0]][::-1])
plb.xlabel("Weight")
plb.ylabel("Term")
plb.title("Highest Weighted Terms in Basis Vector W%d" % (c + 1))
plb.grid(True)
plb.savefig("documents_basisW%d.png" % (c + 1), bbox_inches = "tight")
print "... Finished."
开发者ID:SkyTodInfi,项目名称:MF,代码行数:26,代码来源:documents.py
示例5: show_binary_images
def show_binary_images(samples, nsamples, d1, d2, nrows, ncols):
"""
Plots samples in a NumPy 2D array ``samples`` as ``d1`` by ``d2`` images.
(one sample per row of ``samples``).
The samples are assumed to be images with binary pixels. The
images are layed out in a ``nrows`` by ``ncols`` grid.
"""
perm = range(nsamples)
#random.shuffle(perm)
if samples.shape[0] < nrows*ncols:
samples_padded = numpy.zeros((nrows*ncols,samples.shape[1]))
samples_padded[:samples.shape[0],:] = samples
samples = samples_padded
image = 0.5*numpy.ones((nrows*(d1+1)-1,ncols*(d2+1)-1),dtype=float)
for i in range(nrows):
for j in range(ncols):
image[(i*d1+i):((i+1)*d1+i),(j*d2+j):((j+1)*d2+j)] = (1-samples[perm[i*ncols + j]].reshape(d1,d2))
bordered_image = 0.5 * numpy.ones((nrows*(d1+1)+1,ncols*(d2+1)+1),dtype=float)
bordered_image[1:nrows*(d1+1),1:ncols*(d2+1)] = image
imshow(bordered_image,cmap = cm.Greys,interpolation='nearest')
xticks([])
yticks([])
开发者ID:goelhardik,项目名称:projects,代码行数:27,代码来源:visualize.py
示例6: plot_ea
def plot_ea(frame1, filt_df, dst_path, uplift_rate, riv_case):
f = plt.figure()
ax = filt_df.plot(x='ApatiteHeAge', y='Elevation', style='o-', ax=f.gca())
plt.title('Age-Elevation')
plt.xlabel('ApatiteHeAge [Ma]')
plt.ylabel('Elevation [Km]')
#tread line
sup_age, slope, r_square = find_max_treadline(filt_df, uplift_rate * np.sin(np.deg2rad(60)), riv_case)
x = filt_df[filt_df['ApatiteHeAge'] < sup_age]['ApatiteHeAge']
y = filt_df[filt_df['ApatiteHeAge'] < sup_age]['Points:2']
z = np.polyfit(x, y, 1)
p = np.poly1d(z)
# plt.legend(point_lables, loc='best', fontsize=10)
# n = np.linspace(min(frame1[frame1['Points:2'] > min(frame1['Points:2'])]['ApatiteHeAge']), max(frame1['ApatiteHeAge']), 21)
n = np.linspace(min(filt_df[filt_df['Points:2'] >= min(filt_df['Points:2'])]['ApatiteHeAge']), max(filt_df['ApatiteHeAge']), 21)
plt.plot(n, p(n) - min(frame1['Points:2']),'-r')
ax.text(np.mean(n), np.mean(p(n) - min(frame1['Points:2'])), 'y=%.6fx + b'%(z[0]), fontsize = 20)
txs = np.linspace(np.round(min(filt_df['Elevation'])), np.ceil(max(filt_df['Elevation'])), 11)
lebs = ['0'] + [str(i) for i in txs[1:]]
plt.yticks(txs, list(reversed(lebs)))
plt.savefig(dst_path)
plt.close()
return z[0]
开发者ID:imalkov82,项目名称:Model-Executor,代码行数:27,代码来源:pecanalysis.py
示例7: plot
def plot(frame,dirname,clim=None,axis_limits=None):
if not os.path.exists('./figures'):
os.makedirs('./figures')
try:
sol=Solution(frame,file_format='petsc',read_aux=False,path='./saved_data/'+dirname+'/_p/',file_prefix='claw_p')
except IOError:
'Data file not found; please unzip the files in saved_data/.'
return
x=sol.state.grid.x.centers; y=sol.state.grid.y.centers
mx=len(x); my=len(y)
mp=sol.state.num_eqn
yy,xx = np.meshgrid(y,x)
p=sol.state.q[0,:,:]
if clim is not None:
pl.pcolormesh(xx,yy,p,cmap=cm.RdBu_r)
else:
pl.pcolormesh(xx,yy,p,cmap=cm.Reds)
pl.title("t= "+str(sol.state.t),fontsize=20)
pl.xticks(size=20); pl.yticks(size=20)
cb = pl.colorbar();
if clim is not None:
pl.clim(clim[0],clim[1]);
imaxes = pl.gca(); pl.axes(cb.ax)
pl.yticks(fontsize=20); pl.axes(imaxes)
pl.axis('equal')
if axis_limits is None:
pl.axis([np.min(x),np.max(x),np.min(y),np.max(y)])
else:
pl.axis([axis_limits[0],axis_limits[1],axis_limits[2],axis_limits[3]])
pl.savefig('./figures/'+dirname+'.png')
pl.close()
开发者ID:ketch,项目名称:diffractons_RR,代码行数:35,代码来源:waves_2D_plots.py
示例8: imshow_
def imshow_(x, **kwargs):
if x.ndim == 2:
plt.imshow(x, interpolation="nearest", **kwargs)
elif x.ndim == 1:
plt.imshow(x[:,None].T, interpolation="nearest", **kwargs)
plt.yticks([])
plt.axis("tight")
开发者ID:colincsl,项目名称:LCTM,代码行数:7,代码来源:utils.py
示例9: plot_rfs
def plot_rfs(size, C, Rx, Ry, color='b'):
radius = np.sqrt(size[...]/np.pi)
a, w = 0, C.shape[0]
plt.scatter(Rx, Ry, s=15, color='w', edgecolor='k')
plt.scatter(C[a:w, 1], C[a:w, 0], s=radius*500, alpha=0.4, color=color)
plt.xticks([])
plt.yticks([])
开发者ID:gdetor,项目名称:SI-RF-Structure,代码行数:7,代码来源:DNF-RF-Size.py
示例10: OnButtonTidyButton
def OnButtonTidyButton(self, event):
# for easy coding
T = self.TreeCtrlMain
s = T.GetSelection()
f = self.GetTreeItemData(s, "figure")
w = self.GetTreeItemData(s, "window")
# set the current figure
pylab.figure(f.number)
# first set the size of the window
w.SetSize([500,500])
# now loop over all the data and get the range
lines = f.axes[0].get_lines()
# we want thick lines
f.axes[0].get_frame().set_linewidth(3.0)
# get the tick lines in one big list
xticklines = f.axes[0].get_xticklines()
yticklines = f.axes[0].get_yticklines()
# set their marker edge width
pylab.setp(xticklines+yticklines, mew=2.0)
# set what kind of tickline they are (outside axes)
for l in xticklines: l.set_marker(matplotlib.lines.TICKDOWN)
for l in yticklines: l.set_marker(matplotlib.lines.TICKLEFT)
# get rid of the top and right ticks
f.axes[0].xaxis.tick_bottom()
f.axes[0].yaxis.tick_left()
# we want bold fonts
pylab.xticks(fontsize=20, fontweight='bold', fontname='Arial')
pylab.yticks(fontsize=20, fontweight='bold', fontname='Arial')
# we want to give the labels some breathing room (1% of the data range)
for label in pylab.xticks()[1]:
label.set_y(-0.02)
for label in pylab.yticks()[1]:
label.set_x(-0.01)
# set the position/size of the axis in the window
f.axes[0].set_position([0.1,0.1,0.8,0.8])
# set the axis labels
f.axes[0].set_title('')
f.axes[0].set_xlabel('')
f.axes[0].set_ylabel('')
# set the position of the legend far away
f.axes[0].legend(loc=[1.2,0])
f.canvas.Refresh()
# autoscale
self.OnButtonAutoscaleButton(None)
开发者ID:Spinmob,项目名称:Old-spinmob,代码行数:60,代码来源:_pylab_helper_frame.py
示例11: test
def test(args):
data = multivariate_normal([0, 0], [[1, 2], [2, 5]], int(args[1]))
print(data)
# PCA
result = pca(data, base_num=int(args[2]))
pc_base = result[0]
print(pc_base)
# Plotting
fig = plt.figure()
fig.add_subplot(1, 1, 1)
plt.axvline(x=0, color="#000000")
plt.axhline(y=0, color="#000000")
# Plot data
plt.scatter(data[:, 0], data[:, 1])
# Draw the 1st principal axis
pc_line = sp.array([-3.0, 3.0]) * (pc_base[1] / pc_base[0])
plt.arrow(0, 0, -pc_base[0] * 2, -pc_base[1] * 2, fc="r", width=0.15, head_width=0.45)
plt.plot([-3, 3], pc_line, "r")
# Settings
plt.xticks(size=15)
plt.yticks(size=15)
plt.xlim([-3, 3])
plt.tight_layout()
plt.show()
plt.savefig("image.png")
return 0
开发者ID:id774,项目名称:sandbox,代码行数:28,代码来源:pca.py
示例12: __init__
def __init__(self, List,Matrix,Artist1="NOTSELECT",Artist2="NOTSELECT"):
artists = List
del artists[0]
self.G = nx.Graph()
#ノード追加
for artist in artists:
self.G.add_node("".join(artist).replace("%20"," "))
#エッジ追加
for i, artist in enumerate(artists):
SimArtist = np.argsort(Matrix[i,:])
A = artists[SimArtist[len(artists)-2]]
self.G.add_edge("".join(artist).replace("%20"," "), "".join(A).replace("%20"," "))
#レイアウト
pos = nx.spring_layout(self.G)
#ノード、エッジ調整
nx.draw_networkx_nodes(self.G, pos, node_size =20, node_color="blue")
if Artist1 != "NOTSELECT" and Artist2 != "NOTSELECT":
nx.draw_networkx_nodes(self.G,pos,nodelist=[Artist1,Artist2], node_color= "red" , node_size = 30)
nx.draw_networkx_edges(self.G, pos, width=1)
text_items = nx.draw_networkx_labels(self.G, pos, font_size=0.5, font_color="black")
#フォント調整
#font_path ="/Users/MASANAOHIROTA/.matplotlib/ipaexm.ttf"
font_path ="/Library/Fonts/ヒラギノ明朝 Pro W3.otf"
#font_path="/Library/Fonts/ヒラギノ丸ゴ Pro W4.otf"
font_prop = fm.FontProperties(fname=font_path)
for t in text_items.values():
t.set_fontproperties(font_prop)
#描画
plt.xticks([])
plt.yticks([])
plt.show()
开发者ID:masa26hiro,项目名称:2015_sotsuken,代码行数:31,代码来源:sotsuken_gui.py
示例13: screeplot
def screeplot(filepath, sigma, comps, div=2, vis=False):
y = sigma
x = np.arange(len(y)) + 1
plt.subplot(2, 1, 1)
plt.plot(x, y, "o-", ms=2)
xticks = ["Comp." + str(i) if i%2 == 0 else "" for i in x]
plt.xticks(x, xticks, rotation=45, fontsize=20)
# plt.yticks([0, .25, .5, .75, 1], fontsize=20)
plt.yticks(fontsize=15)
plt.ylabel("Variance", fontsize=20)
plt.xlim([0, len(y)])
plt.title("Plot of the variance of each Singular component", fontsize=25)
plt.axvspan(10, 11, facecolor='g', alpha=0.5)
filepath_g = os.path.join(filepath, "graphs")
if not os.path.exists(filepath_g):
os.makedirs(filepath_g)
plt.savefig(filepath_g + "/scree_plot.png", bbox_inches='tight')
if vis:
plt.show()
开发者ID:PDuckworth,项目名称:activity_analysis,代码行数:25,代码来源:utils.py
示例14: dispcouplets
def dispcouplets(fname, rows=2, cols=2, size='small',
divs=7, normalized=False):
import numpy as np
import matplotlib.pylab as plt
chars=sorted(nletddict(fname, 1))
sp = nletddict(fname, 2)
mat = [[sp[ci+cj] for cj in chars] for ci in chars]
matlab = [[ci+cj for cj in chars] for ci in chars]
maxcount = max(max(mat))
l = len(chars)
pos = np.arange(l)+.5
for s in range(0, l, rows*cols):
plt.figure()
for i in range(rows*cols):
if i+s<l:
plt.subplot(rows, cols, i+1)
plt.barh(pos,mat[i+s],align='center')
plt.yticks(pos,map(repr,map(second, matlab[i+s])))
plt.ylabel("couplets")
plt.xlabel("count")
if not normalized:
plt.xticks(np.arange(divs+1)*maxcount/divs, size=size)
else:
plt.xticks(size=size)
plt.title("The %d couplets that begin with %s" % (sum(mat[i+s]), repr(matlab[i+s][0][0])))
plt.show()
开发者ID:PhillipNordwall,项目名称:nletcount,代码行数:26,代码来源:nletcount.py
示例15: PSTH
def PSTH(self):
TimeRes = np.array([0.1,0.25,0.5,1,2.5,5.0,10.0,25.0,50.0,100.0])
Projection_PSTH = np.zeros((2,len(TimeRes)))
for i in range(0,len(TimeRes)):
Data_Hist,STA_Hist,Model_Hist,B = Hist(TimeRes[i])
data = Data_Hist/np.linalg.norm(Data_Hist)
sta = STA_Hist/np.linalg.norm(STA_Hist)
model = Model_Hist/np.linalg.norm(Model_Hist)
Projection_PSTH[0,i] = np.dot(data,sta)
Projection_PSTH[1,i] = np.dot(data,model)
import matplotlib.font_manager as fm
plt.figure()
plt.semilogx(TimeRes,Projection_PSTH[0,:],'gray',TimeRes,Projection_PSTH[1,:],'k',
linewidth=3, marker='o', markersize = 12)
plt.xlabel('Time Resolution, ms',fontsize=25)
plt.xticks(fontsize=25)
#plt.axis["right"].set_visible(False)
plt.ylabel('Projection onto PSTH',fontsize=25)
plt.yticks(fontsize=25)
prop = fm.FontProperties(size=20)
plt.legend(('1D model','2D model'),loc='upper left',prop=prop)
plt.tight_layout()
plt.show()
开发者ID:bps10,项目名称:LN-model,代码行数:28,代码来源:LNplotting.py
示例16: Iris_network
def Iris_network(ant, data):
#G = nx.watts_strogatz_graph(100,3,0.6)
#G = nx.cubical_graph()
G = nx.Graph() #無向グラフ
tmp1 = []
tmp2 = []
tmp3 = []
for i in range(len(data)):
if data[i][4] == 'setosa':
tmp1.append(str(i))
elif data[i][4] == 'versicolor':
tmp2.append(str(i))
elif data[i][4] == 'virginica':
tmp3.append(str(i))
for i in range(len(data)):
if len(ant[i].parent) == 0 : pass
else:
dest = ant[i].parent[0]
#G.add_edge(str(ant[i].data), str(ant[dest].data))
G.add_edge(str(ant[i].Id), str(ant[dest].Id))
pos = nx.spring_layout(G)
nx.draw_networkx_nodes(G, pos, nodelist=tmp1, node_size=30, node_color="r")
nx.draw_networkx_nodes(G, pos, nodelist=tmp2, node_size=30, node_color="w")
nx.draw_networkx_nodes(G, pos, nodelist=tmp3, node_size=30, node_color="w")
nx.draw_networkx_edges(G, pos, width=1)
#nx.draw_networkx_labels(G, pos, font_size=10, font_color="b")
plt.xticks([])
plt.yticks([])
plt.show()
开发者ID:ae14gotou,项目名称:tokuken2,代码行数:33,代码来源:network_Ant.py
示例17: STAplot
def STAplot(self, option = 0):
try:
self.Files.OpenDatabase(self.NAME + '.h5')
STA_TIME = self.Files.QueryDatabase('STA_Analysis', 'STA_TIME')[0]
STA_Current = self.Files.QueryDatabase('STA_Analysis', 'STAstim')
INTSTEP = self.Files.QueryDatabase('DataProcessing', 'INTSTEP')[0][0]
except:
print 'Sorry no data found'
X = np.arange(-STA_TIME / INTSTEP, STA_TIME / INTSTEP, dtype=float) * INTSTEP
if option == 1:
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(X[0:(STA_TIME/INTSTEP)],STA_Current[0:(STA_TIME/INTSTEP)],
linewidth=3, color='k')
ax.plot(np.arange(-190,-170),np.ones(20)*0.35, linewidth=5,color='k')
ax.plot(np.ones(200)*-170,np.arange(0.35,0.549,0.001),linewidth=5,color='k')
ax.plot(np.arange(-200,0),np.zeros(200), 'k--', linewidth=2)
plt.axis('off')
plt.show()
if option == 0:
fig = plt.figure(figsize=(12,8))
ax = fig.add_subplot(111)
ax.plot(X[0:(STA_TIME / INTSTEP) + 50], STA_Current[0:(STA_TIME / INTSTEP) + 50],
linewidth=3, color='k')
plt.xticks(fontsize = 20)
plt.yticks(fontsize = 20)
plt.ylabel('current(pA)', fontsize = 20)
plt.legend(('data'), loc='upper right')
plt.show()
开发者ID:bps10,项目名称:LN-model,代码行数:33,代码来源:LNplotting.py
示例18: minj_mflux
def minj_mflux(*args,**kwargs):
Qu = jana.quantities()
Minj_List =[]
Minj_MHD_List=[]
for i in range(len(args[1])):
Minj_List.append(Qu.Mflux(args[1][i],Mstar=args[0][i],scale=True)['Mfr']+Qu.Mflux(args[1][i],Mstar=args[0][i],scale=True)['Mfz'])
MHD_30minj = Qu.Mflux(args[2],Mstar=30.0,scale=True)['Mfr']+Qu.Mflux(args[2],Mstar=30.0,scale=True)['Mfz']
for i in args[0]:
Minj_MHD_List.append(MHD_30minj*np.sqrt(i/30.0))
f1 = plt.figure(num=1)
ax1 = f1.add_subplot(211)
plt.axis([10.0,70.0,2.0e-5,7.99e-5])
plt.plot(args[0],Minj_MHD_List,'k*')
plt.plot(args[0],Minj_List,'ko')
plt.minorticks_on()
locs,labels = plt.yticks()
plt.yticks(locs, map(lambda x: "%.1f" % x, locs*1e5))
plt.text(0.0, 1.03, r'$10^{-5}$', transform = plt.gca().transAxes)
plt.xlabel(r'Stellar Mass : $M_{*} [M_{\odot}]$')
plt.ylabel(r' $\dot{M}_{\rm vert} + \dot{M}_{\rm rad}\, [M_{\odot}\,\rm yr^{-1}]$')
ax2 = f1.add_subplot(212)
plt.axis([10.0,70.0,0.0,50.0])
plt.plot(args[0],100*((np.array(Minj_List)-np.array(Minj_MHD_List))/np.array(Minj_MHD_List)),'k^')
plt.minorticks_on()
plt.xlabel(r'Stellar Mass : $M_{*} [M_{\odot}]$')
plt.ylabel(r'$\%$ Change in Total Mass Outflow Rates')
开发者ID:Womble,项目名称:analysis-tools,代码行数:29,代码来源:nice_plots.py
示例19: plotRocCurves
def plotRocCurves(lesion, lesion_en):
file_legend = []
for techniqueMid in techniquesMid:
for techniqueLow in techniquesLow:
file_legend.append((directory + techniqueLow + "/" + techniqueMid + "/operating-points-" + lesion + "-scale.dat", "Low-level: " + techniqueLow + ". Mid-level: " + techniqueMid + "."))
pylab.clf()
pylab.figure(1)
pylab.xlabel('1 - Specificity', fontsize=12)
pylab.ylabel('Sensitivity', fontsize=12)
pylab.title(lesion_en)
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]
x.append(0.0)
y.append(0.0)
auc = numpy.trapz(y, x) * -100
pylab.grid()
pylab.plot(x, y, '-', linewidth = 1.5, label = legend + u" (AUC = {0:0.1f}%)".format(auc))
pylab.legend(loc = 4, borderaxespad=0.4, prop={'size':12})
pylab.savefig(directory + "plots/" + lesion + ".pdf", format='pdf')
开发者ID:piresramon,项目名称:pires.ramon.msc,代码行数:30,代码来源:classification.py
示例20: plot_hourly_comparisions
def plot_hourly_comparisions(s1,s2,s3,s4,s5,s6,s7,s8):
stages_array=[]
stages_array.append(s1)
stages_array.append(s2)
stages_array.append(s3)
stages_array.append(s4)
stages_array.append(s5)
stages_array.append(s6)
stages_array.append(s7)
stages_array.append(s8)
i=1
for i in range(1,11):
initial_epoch_value=(i-1)*120
final_epoch_value=((i-1)*120)+119
#final_epoch_value2=((i-1)*120)+65
stages_hourly=stages_array[6][initial_epoch_value:final_epoch_value]
stages_hourly2=stages_array[7][initial_epoch_value:final_epoch_value]
#stages_hourly3=stages_array[5][initial_epoch_value:final_epoch_value]
#stages_hourly4=stages_array[7][initial_epoch_value:final_epoch_value]
z=len(stages_hourly)
plt.figure()
time= np.arange(1,z+1)
plt.plot(time, stages_hourly,drawstyle='steps',label='Good Sleep')
plt.plot(time, stages_hourly2,drawstyle='steps',label='Bad Sleep')
#plt.plot(time, stages_hourly3,drawstyle='steps',label='Subject3')
#plt.plot(time, stages_hourly4,drawstyle='steps',label='Subject4')
plt.title('Subject4- Comparision - Hour'+' '+str(i))
plt.xlabel('Epochs')
plt.ylabel('Stages')
plt.yticks(np.arange(-1,9))
plt.legend(bbox_to_anchor=(0.65, 1), loc=2, borderaxespad=0.)
plt.show()
plt.savefig('hour-'+str(i))
开发者ID:KiranGanji,项目名称:neuraldata,代码行数:33,代码来源:final_project.py
注:本文中的matplotlib.pylab.yticks函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论