本文整理汇总了Python中mpl_toolkits.axes_grid.axislines.SubplotZero.text方法的典型用法代码示例。如果您正苦于以下问题:Python SubplotZero.text方法的具体用法?Python SubplotZero.text怎么用?Python SubplotZero.text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpl_toolkits.axes_grid.axislines.SubplotZero
的用法示例。
在下文中一共展示了SubplotZero.text方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _blank_plot
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import text [as 别名]
def _blank_plot(domain, ran):
# make the plot
fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
# thicken the axis lines
ax.axhline(linewidth=1.7, color="k")
ax.axvline(linewidth=1.7, color="k")
x_lower, x_upper = int(domain.left), int(domain.right) # needs to be changed, is just a temporary type changer
y_lower, y_upper = int(ran.left), int(ran.right)
# remove tick lines on the axes
plt.xticks([])
plt.yticks([])
plt.ylim(y_lower, y_upper)
plt.xlim(x_lower, x_upper)
# add axes labels
ax.text(1.05, 0, r'$x$', transform=BlendedGenericTransform(ax.transAxes, ax.transData), va='center')
ax.text(0, 1.05, r'$y$', transform=BlendedGenericTransform(ax.transData, ax.transAxes), ha='center')
# end-of-axis arrows
x_width = (abs(plt.xlim()[0]) + abs(plt.xlim()[1]))
y_width = (abs(plt.ylim()[0]) + abs(plt.ylim()[1]))
plt.arrow(plt.xlim()[1], -0.003, 0.00000000001, 0,
width=x_width*0.0015*0.5, color="k", clip_on=False,
head_width=y_width*0.12/7, head_length=x_width*0.024*0.5)
plt.arrow(0.003, plt.ylim()[1], 0, 0.00000000001,
width=y_width*0.0015*0.5, color="k", clip_on=False,
head_width=x_width*0.12/7, head_length=y_width*0.024*0.5)
# only show cartesian axes
for direction in ["xzero", "yzero"]:
ax.axis[direction].set_visible(True)
for direction in ["left", "right", "bottom", "top"]:
ax.axis[direction].set_visible(False)
示例2: zip
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import text [as 别名]
for direction in ["left", "right", "bottom", "top"]:
ax.axis[direction].set_visible(False)
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',
示例3: zip
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import text [as 别名]
theta = np.linspace(0, np.pi, 31)
# draw some circles:
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)
示例4: f
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import text [as 别名]
def f(x, t):
return t * x - t**2 # 関数fの定義
if 1:
fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
ax.axhline(linewidth=1.7, color="black")
ax.axvline(linewidth=1.7, color="black")
plt.xticks([])
plt.yticks([])
plt.ylim([-20,40])
ax.text(0, 1.05, '$y$', transform=BlendedGenericTransform(ax.transData, ax.transAxes), ha='center')
ax.text(1.05, 0, '$x$', transform=BlendedGenericTransform(ax.transAxes, ax.transData), va='center')
# 軸の書式設定(謎)
for direction in ["xzero", "yzero"]:
ax.axis[direction].set_axisline_style("-|>")
ax.axis[direction].set_visible(True)
for direction in ["left", "right", "bottom", "top"]:
ax.axis[direction].set_visible(False)
x = np.linspace(-10, 10, 200)
for i in range(-5,6): # グラフを書く作業を繰り返す範囲
y = f(x, t=i)
ax.plot(x, y, 'black', linewidth=2)
plt.show()
示例5: main
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import text [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()
示例6: f
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import text [as 别名]
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.axislines import SubplotZero
import numpy as np
import fractions
# 改変箇所をまとめておく
FIGNUM = 1 # 0 or 1
if FIGNUM == 0:
t_max, step = 2, fractions.Fraction(1,3) # 傾きの最大、最小値の設定
# 傾きをいくつ刻みで変化させるか。分数のまま計算させるためにFraction()を利用した
if FIGNUM == 1:
t_max, step = 3, fractions.Fraction(1,2)
x_max = 7
y_max = 6
y_min = -5
def f(x, t):
return t*x-t**2
# 以上が改変箇所
t_min = -t_max # 対称性の利用
x_min = -x_max
if 1:
fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
for direction in ["xzero", "yzero"]:
ax.axis[direction].set_axisline_style("-|>")
ax.axis[direction].set_visible(True)
for direction in ["left", "right", "bottom", "top"]: