本文整理汇总了Python中mpl_toolkits.axes_grid.axislines.SubplotZero.plot方法的典型用法代码示例。如果您正苦于以下问题:Python SubplotZero.plot方法的具体用法?Python SubplotZero.plot怎么用?Python SubplotZero.plot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpl_toolkits.axes_grid.axislines.SubplotZero
的用法示例。
在下文中一共展示了SubplotZero.plot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [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
示例2: tell_winner
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [as 别名]
def tell_winner(self, winner, *args):
if self.show_text:
print winner, "has won the game!"
if not self.run_trials: return
if self.graph:
from mpl_toolkits.axes_grid.axislines import SubplotZero
import matplotlib.pyplot as plt
fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.suptitle("Winrate of %s over time"%(self.stats.keys()[0]))
fig.add_subplot(ax)
ax.plot(self.stats.values()[0])
plt.show()
print self.stats.values()[0]
示例3: renderGraph
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [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)
示例4: main
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [as 别名]
def main(path, name):
from numpy import linspace, loadtxt
d = SimulatedData(path)
psth = d.spike_time.psth()
from mpl_toolkits.axes_grid.axislines import SubplotZero
import matplotlib.pyplot as plt
f1 = plt.figure(figsize=[6,8])
ax = SubplotZero(f1, 411)
f1.add_subplot(ax)
psth.plot_raster(ax)
ax = SubplotZero(f1, 412)
f1.add_subplot(ax)
psth.plot_rate(ax, smoothed=True)
ax = SubplotZero(f1, 413)
f1.add_subplot(ax)
dat = loadtxt(d.path['ML response'])
t = linspace(0, 5000, dat.size)
ax.plot(t, dat, 'k')
for direction in ["left", "right", "top", "bottom"]:
ax.axis[direction].set_visible(False)
logging.info(str(dir(ax.axis["bottom"])))
# ax.axis["bottom"].major_ticklabels=[]
ax.set_title("ML")
ax = SubplotZero(f1, 414)
f1.add_subplot(ax)
dat = loadtxt(d.path['HHLS response'])
t = linspace(0, 5000, dat.size)
ax.plot(t, dat, 'k')
for direction in ["left", "right", "top"]:
ax.axis[direction].set_visible(False)
ax.axis["bottom"].set_label("Time (ms)")
ax.set_title("HHLS")
f1.subplots_adjust(hspace=0.47, top=0.95, bottom=0.05)
f2 = plt.figure(figsize=[4,4])
ax = SubplotZero(f2, 111)
f2.add_subplot(ax)
mf = psth.hist_mean_rate(ax, bins=linspace(0,8,20))
ax.set_title({"highvar": "High variance", "lowvar": "Low variance"}[name])
print "Mean firing rate =", mf.mean(), "Hz", "(", mf.std(),")"
plt.show()
示例5: renderGraph
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [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);
示例6: plotAxis
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [as 别名]
def plotAxis(self, matrix):
#funct = gvbars(delta=0.05, color=color.blue)
#for i in range(0, len(matrix[0])):
# funct.plot(pos=(0,matrix[0][i]))
#pylab.scatter(3,4, s=100 ,marker='o', c=color.green)
#pylab.show()
fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
flattenMatrix = np.transpose(matrix).flatten()
x = np.linspace(0., 10., len(flattenMatrix))
print 'x ' + str(x)
print 'matrix: ' + str(np.transpose(matrix).flatten())
#ax.plot(x, np.sin(x*np.pi), linewidth=2.0)
ax.plot(matrix, 0, linewidth=2.0)
plt.show()
示例7: visualize_test_between_class
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [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()
示例8: graphWaveSamples
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [as 别名]
def graphWaveSamples(samples):
y = [struct.unpack('h', i)[0] for i in samples]
#print y
print "max:", max(y)
print "min:", min(y)
print "avg:", sum(y)/float(len(y))
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"]:
ax.axis[direction].set_visible(False)
x = range(len(y))
ax.plot(x, y)
plt.show()
示例9: draw_graph
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [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')
示例10: SubplotZero
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [as 别名]
until_x1 = np.arange(0.0, x1, 0.01)
wave_until_x1 = [tunneling_wave(t, x1, x2, omega, amplitude1, amplitude2) for t in until_x1]
from_x2 = np.arange(x2+0.01, 5*np.pi, 0.01)
wave_from_x2 = [tunneling_wave(t, x1, x2, omega, amplitude1, amplitude2) for t in from_x2]
colors=initialize_graphics()
fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
#fig, ax = plt.subplots()
fig.set_size_inches(cm2inch([10,5]))
ax.plot(full_range, potential, lw=2, color=colors[2])
ax.plot(until_x1, wave_until_x1, lw=2, color=colors[0])
ax.plot(from_x2, wave_from_x2, lw=2, color=colors[0])
ax.annotate('$U(x)$', xy=(x2, V0), xytext=(x2+0.3, V0-0.2))
ax.set_frame_on(False)
#ax.axes.get_yaxis().set_visible(False)
ax.axes.get_xaxis().set_ticks([x1, x2, 5*np.pi+0.5])
ax.axes.get_xaxis().set_ticklabels(['$x_1$','$x_2$', '$x$'])
ax.axis["xzero"].set_axisline_style("-|>")
ax.axis["xzero"].set_visible(True)
ax.axis["yzero"].set_visible(False)
for direction in ["left", "right", "bottom", "top"]:
ax.axis[direction].set_visible(False)
示例11: SubplotZero
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [as 别名]
#!/usr/bin/python
print "content-type: text/html\n"
import cgi,cgitb
cgitb.enable()
from mpl_toolkits.axes_grid.axislines import SubplotZero
import matplotlib.pyplot as plt
import numpy as np
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"]:
ax.axis[direction].set_visible(False)
x = np.linspace(-0.5, 1., 100)
ax.plot(x, np.sin(x*np.pi))
plt.show()
示例12: SubplotZero
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [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()
示例13: SubplotZero
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [as 别名]
# Setup plotting for our polar grid
fig = plt.figure(1, figsize=(7,7))
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
# add axis lines for coordinate geometry (4 quadrants)
for direction in ["xzero", "yzero"]:
ax.axis[direction].set_axisline_style("-|>", size=.75)
ax.axis[direction].set_visible(True)
# remove axis lines/labels for rectangular geometry (-x and -y don't exist)
for direction in ["left", "right", "bottom", "top"]:
ax.axis[direction].set_visible(False)
X = [] # hold x-coordinates from radial dividers
Y = [] # hold y-coordinates from radial dividers
# Generate geometry for a polar grid of 4-unit radius, centroid at (-2,1), with 8 divisions and precision of 4000 points
geom = polar_grid(rho=4, centroid=(-2,1), theta=8, tau=4000)
# Add coordinates from each radial divider to the X and Y lists
for num in range(0, len(geom)):
for (x,y) in geom[num][1]:
X.append(x)
Y.append(y)
# Plot the coordinate pairs and connect each subsequent pair with a basic line
ax.plot(X,Y, color='red', linewidth=.75)
plt.margins(.25)
plt.show()
示例14: SubplotZero
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [as 别名]
"""
#!/usr/bin/python
print "content-type: text/html\n"
import cgitb
cgitb.enable()
import os
os.environ['HOME']='/~charles.zhang/Grapher'
import matplotlib
matplotlib.use('Agg')
from mpl_toolkits.axes_grid.axislines import SubplotZero
import matplotlib.pyplot as plt
import numpy as np
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"]:
ax.axis[direction].set_visible(False)
x = np.linspace(-0.5, 1., 100)
ax.plot(x, np.cos(x*np.pi))
plt.show()
示例15: SubplotZero
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import plot [as 别名]
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.axislines import SubplotZero
import numpy as np
fig = plt.figure(1, (4,3))
# a subplot with two additiona axis, "xzero" and "yzero". "xzero" is
# y=0 line, and "yzero" is x=0 line.
ax = SubplotZero(fig, 1, 1, 1)
fig.add_subplot(ax)
# make xzero axis (horizontal axis line through y=0) visible.
ax.axis["xzero"].set_visible(True)
ax.axis["xzero"].label.set_text("Axis Zero")
# make other axis (bottom, top, right) invisible.
for n in ["bottom", "top", "right"]:
ax.axis[n].set_visible(False)
xx = np.arange(0, 2*np.pi, 0.01)
ax.plot(xx, np.sin(xx))
plt.show()