本文整理汇总了Python中mpl_toolkits.axes_grid.axislines.SubplotZero.axis方法的典型用法代码示例。如果您正苦于以下问题:Python SubplotZero.axis方法的具体用法?Python SubplotZero.axis怎么用?Python SubplotZero.axis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpl_toolkits.axes_grid.axislines.SubplotZero
的用法示例。
在下文中一共展示了SubplotZero.axis方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import axis [as 别名]
def run(self, results):
par1 = self.getValueOfParameter("parameter 1")
par2 = self.getValueOfParameter("parameter 2")
i = int(self.getValueOfParameter("iteration number"))
title = self.getValueOfParameter("title")
if(par1==""):
return False
if(par2==""):
return False
if(i >= results.__len__()):
return False
dialogform = Dialog(QApplication.activeWindow())
fig = Figure((5.0, 4.0), dpi=100)
ax = SubplotZero(fig, 1, 1, 1)
fig.add_subplot(ax)
for n in ["top", "right"]:
ax.axis[n].set_visible(False)
for n in ["bottom", "left"]:
ax.axis[n].set_visible(True)
x = results[i].getResults(par1)
y = results[i].getResults(par2)
if(not(x.__len__())):
return False
if(not(y.__len__())):
return False
ax.plot(x,y,'.')
#plot middle
xm = range(math.floor(min(ax.axis())),math.floor(max(ax.axis())+1),1)
ax.plot(xm,xm)
ax.set_xlabel(par1)
ax.set_ylabel(par2)
ax.set_title(title)
dialogform.showFigure(fig)
return True
示例2: zip
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import axis [as 别名]
theta = np.linspace(0, np.pi, 31)
# draw some circles:
for i, r, label in zip(range(4), PSET.foursphereParams['radii'], ['brain', 'CSF', 'skull', 'scalp']):
ax.plot(np.cos(theta)*r, np.sin(theta)*r, 'C{}'.format(i), label=label + r', $r_%i=%i$ mm' % (i+1, r / 1000), clip_on=False)
# draw measurement points
ax.plot(PSET.foursphereParams['r'][:, 0], PSET.foursphereParams['r'][:, 2], 'ko', label='EEG/MEG sites')
for i, (x, y, z) in enumerate(PSET.foursphereParams['r']):
ax.text(x, z+2500, r'{}'.format(i+1), ha='center')
# dipole location
ax.plot([0], [PSET.foursphereParams['radii'][0] + PSET.layer_data['center'][3]], 'k.', label='dipole site')
ax.axis('equal')
ax.set_ylim(top=max(PSET.foursphereParams['radii']) + 5000)
ax.set_xticks(np.r_[-np.array(PSET.foursphereParams['radii']), 0, PSET.foursphereParams['radii']])
ax.set_xticklabels([])
ax.legend(loc=(0.25, 0.05), frameon=False)
ax.text(-0.1, 1.05, alphabet[5],
horizontalalignment='center',
verticalalignment='center',
fontsize=16, fontweight='demibold',
transform=ax.transAxes)
示例3: zip
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import axis [as 别名]
for i, r, label in zip(range(4), foursphereParams['radii'], ['brain', 'CSF', 'skull', 'scalp']):
ax3.plot(np.cos(theta)*r, np.sin(theta)*r, 'C{}'.format(i), label=label + r', $r_%i=%i$ mm' % (i+1, r / 1000), clip_on=False)
# draw measurement points
ax3.plot(foursphereParams['r'][:, 0], foursphereParams['r'][:, 2], 'ko', label='EEG/MEG sites')
for i, (x, y, z) in enumerate(foursphereParams['r']):
# theta = np.arcsin(x / foursphereParams['radii'][-1])
# if x >= 0:
# ax3.text(x, z+5000, r'${}\pi$'.format(theta / np.pi))
# else:
# ax3.text(x, z+5000, r'${}\pi$'.format(theta / np.pi), ha='right')
ax3.text(x, z+2500, r'{}'.format(i + 1), ha='center')
# dipole location
ax3.plot([0], [dipole_position[-1]], 'k.', label='dipole site')
ax3.axis('equal')
ax3.set_xticks(np.r_[-np.array(foursphereParams['radii']), 0, foursphereParams['radii']])
ax3.set_xticklabels([])
ax3.legend(loc=(0.25, 0.15), frameon=False)
# four-sphere volume conductor
sphere = LFPy.FourSphereVolumeConductor(
**foursphereParams
)
phi_p = sphere.calc_potential(cell.current_dipole_moment, rz=dipole_position)
# import example_parallel_network_plotting as plotting
vlimround = draw_lineplot(ax=ax4, data=phi_p*1E9, unit=r'pV', #mV -> pV unit conversion
dt=cell.dt, ztransform=False,
示例4: main
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import axis [as 别名]
def main():
opts, args = getopt.getopt(sys.argv[1:], 'u:', ['URL='])
print("Number of arguments: " + str(len(sys.argv)))
if len(sys.argv) > 1:
threadID = str(sys.argv[1])
else:
threadID = '3jms68'
print("Using thread: " + threadID)
r = praw.Reddit(user_agent='test script /u/Speff')
#r.set_oauth_app_info(client_id='aDjUAlJ0Cb17pA',
# client_secret='AeJjd7CLEUt7wyMmTVhP6kidhLc',
# redirect_uri='http://127.0.0.1:65010/'
# 'authorize_callback')
#url = r.get_authorize_url('uniqueKey', 'identity', True)
#print(url)
#access_information = r.get_access_information('lfJfhgKEDDUzgwY9a2tcVtVYMnc')
#r.set_access_credentials(**access_information)
#authenticated_user = r.get_me()
#print(authenticated_user.name, authenticated_user.link_karma)
start = float(time.time())
submission = r.get_submission(submission_id=threadID, comment_sort="confidence")
submission.replace_more_comments(limit=None, threshold=1)
print("Seconds to process thread: " + str(time.time()-start))
flat_comments = praw.helpers.flatten_tree(submission.comments)
submission_score = submission.score
submission_time = submission.created_utc
comment_score = []
comment_time = []
commentInfo = []
#comment_body = []
print("Number of comments: " + str(len(flat_comments)))
for x in flat_comments:
# print(x.body + "\n")
comment_score.append(abs(x.score-1)+1)
comment_time.append((x.created_utc - submission_time)/(60))
# comment_body.append(x.body)
data = np.column_stack((comment_time, comment_score))
uniques, count = np.unique(data[:,1], return_counts=True)
unvoted = 0.0
for x in range(0, len(uniques)):
if(uniques[x]) == 1:
unvoted = count[x]
unvoted = unvoted / len(comment_time)
if 1:
fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
ax.axis["left"].set_label('Points')
ax.axis["bottom"].set_label('Time (minutes)')
xRange = np.amax(data[:,0]) - np.amin(data[:,0])
yRange = np.amax(data[:,1]) - np.amin(data[:,1])
plt.axhline(1, color='gray', linestyle='--')
plt.axhline(0, color='black')
plt.axvline(0, color='black')
xFit = np.linspace(np.amin(data[:,0]) - xRange*0.1, np.amax(data[:,0]) + xRange*0.1, 1000)
A, K, C = fit_exp_nonlinear(data[:,0], data[:,1])
fit_y = 2*model_func(xFit, A, K, C)
print("Best-fit polynomial coefficient(s): " + str((A, K, C)))
ax.axis([np.amin(data[:,0]) - xRange*0.1, np.amax(data[:,0]) + xRange*0.1, np.amin(data[:,1]) - yRange*0.1, np.amax(data[:,1]) + yRange*0.1])
ax.plot(data[:,0], data[:,1], '.')
ax.plot(xFit, fit_y, '-', color='darkred')
ax.text(0.75*xRange + np.amin(data[:,0]), 0.9*yRange + np.amin(data[:,1]), str(round(unvoted,3)*100) + '% unvoted \n', fontsize=15)
plt.show()