本文整理汇总了Python中mpl_toolkits.axes_grid.axislines.SubplotZero.set_ylim方法的典型用法代码示例。如果您正苦于以下问题:Python SubplotZero.set_ylim方法的具体用法?Python SubplotZero.set_ylim怎么用?Python SubplotZero.set_ylim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpl_toolkits.axes_grid.axislines.SubplotZero
的用法示例。
在下文中一共展示了SubplotZero.set_ylim方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: renderGraph
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import set_ylim [as 别名]
def renderGraph(self): # pylint: disable=R0914
assert len(self._oData.aoSeries) == 1
oSeries = self._oData.aoSeries[0]
# hacking
# self.setWidth(512);
# self.setHeight(128);
# end
oFigure = self._createFigure()
from mpl_toolkits.axes_grid.axislines import SubplotZero
# pylint: disable=E0401
oAxis = SubplotZero(oFigure, 111)
oFigure.add_subplot(oAxis)
# Disable all the normal axis.
oAxis.axis["right"].set_visible(False)
oAxis.axis["top"].set_visible(False)
oAxis.axis["bottom"].set_visible(False)
oAxis.axis["left"].set_visible(False)
# Use the zero axis instead.
oAxis.axis["yzero"].set_axisline_style("-|>")
oAxis.axis["yzero"].set_visible(True)
oAxis.axis["xzero"].set_axisline_style("-|>")
oAxis.axis["xzero"].set_visible(True)
if oSeries.aoYValues[-1] == 100:
sColor = "green"
elif oSeries.aoYValues[-1] > 75:
sColor = "yellow"
else:
sColor = "red"
oAxis.plot(oSeries.aoXValues, oSeries.aoYValues, ".-", color=sColor, linewidth=3)
oAxis.fill_between(oSeries.aoXValues, oSeries.aoYValues, facecolor=sColor, alpha=0.5)
oAxis.set_xlim(left=-0.01)
oAxis.set_xticklabels([])
oAxis.set_xmargin(1)
oAxis.set_ylim(bottom=0, top=100)
oAxis.set_yticks([0, 50, 100])
oAxis.set_ylabel("%")
# oAxis.set_yticklabels([]);
oAxis.set_yticklabels(["", "%", ""])
return self._produceSvg(oFigure, False)
示例2: renderGraph
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import set_ylim [as 别名]
def renderGraph(self): # pylint: disable=R0914
assert len(self._oData.aoSeries) == 1;
oSeries = self._oData.aoSeries[0];
# hacking
#self.setWidth(512);
#self.setHeight(128);
# end
oFigure = self._createFigure();
from mpl_toolkits.axes_grid.axislines import SubplotZero;
oAxis = SubplotZero(oFigure, 111);
oFigure.add_subplot(oAxis);
# Disable all the normal axis.
oAxis.axis['right'].set_visible(False)
oAxis.axis['top'].set_visible(False)
oAxis.axis['bottom'].set_visible(False)
oAxis.axis['left'].set_visible(False)
# Use the zero axis instead.
oAxis.axis['yzero'].set_axisline_style('-|>');
oAxis.axis['yzero'].set_visible(True);
oAxis.axis['xzero'].set_axisline_style('-|>');
oAxis.axis['xzero'].set_visible(True);
if oSeries.aoYValues[-1] == 100:
sColor = 'green';
elif oSeries.aoYValues[-1] > 75:
sColor = 'yellow';
else:
sColor = 'red';
oAxis.plot(oSeries.aoXValues, oSeries.aoYValues, '.-', color = sColor, linewidth = 3);
oAxis.fill_between(oSeries.aoXValues, oSeries.aoYValues, facecolor = sColor, alpha = 0.5)
oAxis.set_xlim(left = -0.01);
oAxis.set_xticklabels([]);
oAxis.set_xmargin(1);
oAxis.set_ylim(bottom = 0, top = 100);
oAxis.set_yticks([0, 50, 100]);
oAxis.set_ylabel('%');
#oAxis.set_yticklabels([]);
oAxis.set_yticklabels(['', '%', '']);
return self._produceSvg(oFigure, False);
示例3: draw_graph
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import set_ylim [as 别名]
def draw_graph(self):
min_time = 0
max_time = 0
for val in self.readings:
if min_time == 0:
min_time = val["time"]
if val["time"] < min_time:
min_time = val["time"]
if max_time == 0:
max_time = val["time"]
if val["time"] > max_time:
max_time = val["time"]
fig = plt.figure(1)
fig.subplots_adjust(right=0.85)
ax = SubplotZero(fig, 1, 1, 1)
fig.add_subplot(ax)
plt.title("Score for Game: %s" % self.score)
# make right and top axis invisible
ax.axis["right"].set_visible(False)
ax.axis["top"].set_visible(False)
# make xzero axis (horizontal axis line through y=0) visible.
ax.axis["xzero"].set_visible(False)
ax.set_xlim(min_time, max_time)
ax.set_ylim(0, 4)
ax.set_xlabel("Time")
ax.set_ylabel("HRV")
t_hrv = []
hrv = []
for val in self.readings:
if "hrv" in val.keys():
t_hrv.append(val["time"])
hrv.append(val["hrv"])
else:
ax.plot(val["time"], 2.0, 'r.')
for peak in self.peaks:
ax.plot(peak["time"], peak["hrv"], 'g.', markersize=10)
ax.plot(t_hrv, hrv, 'b-')
plt.savefig('pulse_graph')
示例4: zip
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import set_ylim [as 别名]
# 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)
示例5: SubplotZero
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import set_ylim [as 别名]
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.axislines import SubplotZero
if 1:
fig = plt.figure(1)
fig.subplots_adjust(right=0.85)
ax = SubplotZero(fig, 1, 1, 1)
fig.add_subplot(ax)
ax.axis["right"].set_visible(False)
ax.axis["top"].set_visible(False)
ax.axis["xzero"].set_visible(True)
ax.axis["xzero"].label.set_text("Axis Zero")
ax.set_ylim(-2, 4)
ax.set_xlabel("Label X")
ax.set_ylabel("Label Y")
offset = (20, 0)
new_axisline = ax.get_grid_helper().new_fixed_axis
ax.axis["right2"] = new_axisline(loc="right",
offset=offset,
axes=ax)
ax.axis["right2"].label.set_text("Label Y2")
ax.plot([-2,3,2])
plt.draw()
plt.show()
示例6: zip
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import set_ylim [as 别名]
print h,x,g
soa = np.array([h,x,g]) # vectors
print soa
X,Y,U,V = zip(*soa) # convert to turples of U and V components
fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
colors = ('r','g','b')
qv = ax.quiver(X,Y,U,V,color=colors,angles='xy',scale_units='xy',scale=1)
labels = ('heading: {} deg'.format(hdeg), 'Orientation, drift: {} deg'.format(drift), '{} g at {} deg'.format(aforce,adeg))
pos = ('N','E','S')
for x,y,l,c,p in zip(U,V,labels,colors,pos):
plt.quiverkey(qv,x,y,0,l,color=c,coordinates='data',labelpos=p)
ax.set_xlim([-2,2])
ax.set_ylim([-2,2])
# show cartisian axis
# for direction in ["xzero", "yzero"]:
# ax.axis[direction].set_visible(True)
# turn off side axis
for direction in ["left", "right", "bottom", "top"]:
ax.axis[direction].set_visible(False)
plt.draw()
plt.show()
示例7: main
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import set_ylim [as 别名]
def main():
f = open("game_output.txt", "r")
l = json.load(f)
min_time = 0
for val in l:
if min_time == 0:
min_time = val["time"]
if val["time"] < min_time:
min_time = val["time"]
max_time = 0
for val in l:
if max_time == 0:
max_time = val["time"]
if val["time"] > max_time:
max_time = val["time"]
print "%s %s" % (min_time, max_time)
fig = plt.figure(1)
fig.subplots_adjust(right=0.85)
ax = SubplotZero(fig, 1, 1, 1)
fig.add_subplot(ax)
# make right and top axis invisible
ax.axis["right"].set_visible(False)
ax.axis["top"].set_visible(False)
# make xzero axis (horizontal axis line through y=0) visible.
ax.axis["xzero"].set_visible(False)
#ax.axis["xzero"].label.set_text("Axis Zero")
ax.set_xlim(min_time, max_time)
ax.set_ylim(0, 4)
ax.set_xlabel("Time")
ax.set_ylabel("HRV")
# make new (right-side) yaxis, but wth some offset
# offset = (20, 0)
# new_axisline = ax.get_grid_helper().new_fixed_axis
# ax.axis["right2"] = new_axisline(loc="right",
# offset=offset,
# axes=ax)
# ax.axis["right2"].label.set_text("Label Y2")
#ax.plot([-2,3,2])
t_hrv = []
hrv = []
for val in l:
if "hrv" in val.keys():
t_hrv.append(val["time"])
hrv.append(val["hrv"])
#ax.plot(val["time"], val["hrv"], 'b,')
elif "key" in val.keys():
ax.plot(val["time"], 2.0, 'r,')
ax.plot(t_hrv, hrv, 'b-')
hrv_dict = []
for el in l:
try:
hrv_dict.append((el["time"], el["hrv"]))
except KeyError:
pass
peak_dict = []
current_peak = 0
hrv_window = deque()
hrv_limit = 20
hrv_total = []
stop_counter = 0
hrv_itr = hrv_dict.__iter__()
b = hrv_itr.next()
while 1:
a = [b[0], b[1], 0]
hrv_window.append(a)
hrv_total.append(a)
if len(hrv_window) > hrv_limit:
hrv_window.popleft()
max_hrv = 0
max_time = 0
for h in hrv_window:
if h[1] > max_hrv:
max_time = h[0]
max_hrv = h[1]
for h in hrv_window:
if h[0] == max_time:
h[2] = h[2] + 1
break
try:
c = hrv_itr.next()
b = c
except StopIteration:
stop_counter = stop_counter + 1
if stop_counter == hrv_limit:
break
pulse = 0
for (time, hrv, score) in hrv_total:
#.........这里部分代码省略.........
示例8: SubplotZero
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import set_ylim [as 别名]
from mpl_toolkits.axes_grid.axislines import SubplotZero
from matplotlib import colors
roll = 15
pitch = 5
orig = [0, 0]
X, Y = (0, 0) # origin
U = roll
V = pitch
fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
qv = ax.quiver(X, Y, U, V, color="y", angles="xy", scale_units="xy", scale=1)
ax.set_xlim([-45, 45])
ax.set_ylim([-45, 45])
# show cartisian axis
for direction in ["xzero", "yzero"]:
ax.axis[direction].set_visible(True)
# turn off side axis
# for direction in ["left", "right", "bottom", "top"]:
# ax.axis[direction].set_visible(False)
plt.draw()
plt.show()