本文整理汇总了Python中mpl_toolkits.axes_grid.axislines.SubplotZero.legend方法的典型用法代码示例。如果您正苦于以下问题:Python SubplotZero.legend方法的具体用法?Python SubplotZero.legend怎么用?Python SubplotZero.legend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpl_toolkits.axes_grid.axislines.SubplotZero
的用法示例。
在下文中一共展示了SubplotZero.legend方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: visualize_test_between_class
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import legend [as 别名]
def visualize_test_between_class(self, test, human, non_human):
fig = plt.figure("Trajectories for Test, Human, and Non-Human")
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
line_style = ['r.-', 'gx-', 'bo-']
# plotting test data
x = [i.pose.position.x for i in test]
y = [i.pose.position.y for i in test]
ax.plot(x, y, line_style[0], label="Test")
# plotting human data
x = [i.pose.position.x for i in human]
y = [i.pose.position.y for i in human]
ax.plot(x, y, line_style[1], label="Human")
# plotting non-human data
x = [i.pose.position.x for i in non_human]
y = [i.pose.position.y for i in non_human]
ax.plot(x, y, line_style[2], label="Non-human")
ax.margins(0.05)
ax.legend(loc="lower right", fontsize=10)
plt.title("Chunks of Trajectories")
plt.xlabel("Axis")
plt.ylabel("Ordinate")
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)
pylab.grid()
plt.show()
示例2: run
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import legend [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)
y1 = results[i].getResults(par1)
y2 = results[i].getResults(par2)
if(not(y1.__len__())):
return False
if(not(y2.__len__())):
return False
ax.plot(range(0,y1.__len__()),y1,color='r')
ax.plot(range(0,y2.__len__()),y2,color='b')
ax.set_title(title)
leg = ax.legend((par1, par2),
'upper center', shadow=True)
frame = leg.get_frame()
frame.set_facecolor('0.80') # set the frame face color to light gray
# matplotlib.text.Text instances
for t in leg.get_texts():
t.set_fontsize('small') # the legend text fontsize
# matplotlib.lines.Line2D instances
for l in leg.get_lines():
l.set_linewidth(1.5) # the legend line width
dialogform.showFigure(fig)
return True
示例3: enumerate
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import legend [as 别名]
# 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)
# PANEL G. EEG signal
ax = fig.add_subplot(gs[2, 2])
ax.set_title(r'surface potential $\phi_\mathbf{p}(\mathbf{r})$ ')
f = h5py.File(os.path.join(PSET.OUTPUTPATH,
示例4: enumerate
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import legend [as 别名]
# 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,
T=(0, cell.tstop), color='k', scalebarbasis='log10')
# ax4.set_xticklabels([])
ax4.set_yticklabels([r'{}'.format(i + 1) for i in range(phi_p.shape[0])])