本文整理汇总了Python中pylab.ioff函数的典型用法代码示例。如果您正苦于以下问题:Python ioff函数的具体用法?Python ioff怎么用?Python ioff使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ioff函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: prepare
def prepare(self):
def setField(name):
self.xData = data[name].dimensions[0]
self.yData = data[name]
pylab.xlabel(data[name].dimensions[0].label)
pylab.ylabel(data[name].label)
pylab.ioff()
pylab.figure()
data = self.dataContainer
if self.dataContainer.numberOfColumns() > 2:
if u"Smoothed Absorption" in data.longnames.keys():
setField(u"Smoothed Absorption")
elif u"Absorption" in data.longnames.keys():
setField(u"Absorption")
else:
self.xData = data[u"Wellenlänge[nm]"]
self.yData = data[u"ScopRaw[counts]"]
pylab.ylabel("Scop Raw / a.u.")
else:
self.xData = self.dataContainer[0]
self.yData = self.dataContainer[1]
for i in xrange(len(self.xData.data)):
self.ordinates.append(self.yData.data[i])
self.abscissae.append(self.xData.data[i])
if u"Minima" in data.longnames.keys():
mins = data[u"Minima"]
for i in xrange(len(mins.data)):
self.mins.append(mins.data[i])
pylab.xlabel("Wavelength $\lambda$ / nm")
pylab.title(self.dataContainer.longname)
开发者ID:gclos,项目名称:pyphant1,代码行数:33,代码来源:OscVisualisers.py
示例2: hinton
def hinton(W, maxWeight=None):
"""
Source: http://wiki.scipy.org/Cookbook/Matplotlib/HintonDiagrams
Draws a Hinton diagram for visualizing a weight matrix.
Temporarily disables matplotlib interactive mode if it is on,
otherwise this takes forever.
"""
reenable = False
if pl.isinteractive():
pl.ioff()
pl.clf()
height, width = W.shape
if not maxWeight:
maxWeight = 2**np.ceil(np.log(np.max(np.abs(W)))/np.log(2))
pl.fill(np.array([0,width,width,0]),np.array([0,0,height,height]),'gray')
pl.axis('off')
pl.axis('equal')
for x in xrange(width):
for y in xrange(height):
_x = x+1
_y = y+1
w = W[y,x]
if w > 0:
_blob(_x - 0.5, height - _y + 0.5, min(1,w/maxWeight),'white')
elif w < 0:
_blob(_x - 0.5, height - _y + 0.5, min(1,-w/maxWeight),'black')
if reenable:
pl.ion()
pl.show()
开发者ID:macabot,项目名称:mlpm_lab,代码行数:30,代码来源:vpca.py
示例3: finalize
def finalize(self):
"""
Wraps up plotting by switching off interactive model and showing the
plot.
"""
plt.ioff()
plt.show()
开发者ID:jennyknuth,项目名称:landlab,代码行数:7,代码来源:landlab_ca.py
示例4: plotSpectrum
def plotSpectrum(self,spectrum,title):
fig=plt.figure(figsize=self.figsize, dpi=self.dpi);plt.ioff()
index, bar_width = spectrum.index.values,0.2
for i in range(spectrum.shape[1]):
plt.bar(index + i*bar_width, spectrum.icol(i).values, bar_width, color=mpl.cm.jet(1.*i/spectrum.shape[1]), label=spectrum.columns[i])
plt.xlabel('Allele') ;plt.xticks(index + 3*bar_width, index) ;plt.legend();
plt.title('Figure {}. {}'.format(self.fignumber, title),fontsize=self.titleSize); self.pdf.savefig(fig);self.fignumber+=1
开发者ID:airanmehr,项目名称:popgen,代码行数:7,代码来源:Plot.py
示例5: saveHintonDiagram
def saveHintonDiagram(W, directory):
maxWeight = None
#print "Weight: ", W
"""
Draws a Hinton diagram for visualizing a weight matrix.
Temporarily disables matplotlib interactive mode if it is on,
otherwise this takes forever.
"""
reenable = False
if pylab.isinteractive():
pylab.ioff()
pylab.clf()
height, width = W.shape
if not maxWeight:
maxWeight = 2**numpy.ceil(numpy.log(numpy.max(numpy.abs(W)))/numpy.log(2))
pylab.fill(numpy.array([0,width,width,0]),numpy.array([0,0,height,height]),'gray')
pylab.axis('off')
pylab.axis('equal')
for x in xrange(width):
for y in xrange(height):
_x = x+1
_y = y+1
w = W[y,x]
if w > 0:
_blob(_x - 0.5, height - _y + 0.5, min(1,w/maxWeight),'white')
elif w < 0:
_blob(_x - 0.5, height - _y + 0.5, min(1,-w/maxWeight),'black')
if reenable:
pylab.ion()
#pylab.show()
pylab.savefig(directory)
开发者ID:marcelo-borghetti,项目名称:sampleCode,代码行数:32,代码来源:DataUtil.py
示例6: hinton
def hinton(W, maxWeight=None):
"""
Draws a Hinton diagram for visualizing a weight matrix.
Temporarily disables matplotlib interactive mode if it is on,
otherwise this takes forever.
"""
reenable = False
if P.isinteractive():
P.ioff()
P.clf()
height, width = W.shape
if not maxWeight:
maxWeight = 2**N.ceil(N.log(N.max(N.abs(W)))/N.log(2))
P.fill(N.array([0,width,width,0]),N.array([0,0,height,height]),'gray')
P.axis('off')
P.axis('equal')
for x in xrange(width):
for y in xrange(height):
_x = x+1
_y = y+1
w = W[y,x]
if w > 0:
_blob(_x - 0.5, height - _y + 0.5, min(1,w/maxWeight),'white')
elif w < 0:
_blob(_x - 0.5, height - _y + 0.5, min(1,-w/maxWeight),'black')
if reenable:
P.ion()
P.show()
开发者ID:Neuroglycerin,项目名称:neukrill-net-tools,代码行数:29,代码来源:hinton_diagram.py
示例7: plotOutput
def plotOutput(X,Y,spectrumLabel,ydata,PBool=True,ydataBool=False,residuals=False,path=False):
"""Plots the program outputs for the user"""
import matplotlib
if PBool == False:
matplotlib.use('Agg') #non-interactive backend
import pylab as P
P.ioff() #Ensure interactivity mode is off so that graph does not dissapear immediately
fig = P.figure()
maxYval = amax(Y)
minYval = amin(Y)
DynamicRange = maxYval - minYval
if not ydataBool:
P.plot(X,Y,'g', linewidth = 2.0)
P.xlabel(r'Detuning (GHz)')
P.ylabel(spectrumLabel)
P.xlim(X[0],X[-1])
P.ylim(minYval-0.02*DynamicRange,maxYval+0.02*DynamicRange)
else:
ax1 = fig.add_axes([0.15,0.30,0.75,0.65])
ax1.plot(X,ydata,'k')
ax1.plot(X,Y,'r--', linewidth=1.8)
ax1.set_xlim(X[0],X[-1])
ax1.set_ylim(minYval-0.02*DynamicRange,maxYval+0.02*DynamicRange)
ax1.set_xticklabels([])
P.ylabel(spectrumLabel)
ax2 = fig.add_axes([0.15,0.10,0.75,0.15])
ax2.plot(X,residuals*100.0,'k')
ax2.set_xlim(X[0],X[-1])
ax2.axhline(color='r', linestyle = '--', linewidth=1.8)
P.xlabel(r'Detuning (GHz)')
P.ylabel(r'Residuals $(\times 100)$')
if path:
P.savefig(path)
if PBool:
P.show()
开发者ID:matwid,项目名称:ElecSus,代码行数:35,代码来源:tools.py
示例8: __call__
def __call__(self,output_fn,init_time=0,final_time=None,**params):
p=ParamOverrides(self,params)
if final_time is None:
final_time=topo.sim.time()
attrs = p.attrib_names if len(p.attrib_names)>0 else output_fn.attrib_names
for a in attrs:
pylab.figure(figsize=(6,4))
isint=pylab.isinteractive()
pylab.ioff()
pylab.grid(True)
ylabel=p.ylabel
pylab.ylabel(a+" "+ylabel)
pylab.xlabel('Iteration Number')
coords = p.units if len(p.units)>0 else output_fn.units
for coord in coords:
y_data=[y for (x,y) in output_fn.values[a][coord]]
x_data=[x for (x,y) in output_fn.values[a][coord]]
if p.raw==True:
plot_data=zip(x_data,y_data)
pylab.save(normalize_path(p.filename+a+'(%.2f, %.2f)' %(coord[0], coord[1])),plot_data,fmt='%.6f', delimiter=',')
pylab.plot(x_data,y_data, label='Unit (%.2f, %.2f)' %(coord[0], coord[1]))
(ymin,ymax)=p.ybounds
pylab.axis(xmin=init_time,xmax=final_time,ymin=ymin,ymax=ymax)
if isint: pylab.ion()
pylab.legend(loc=0)
p.title=topo.sim.name+': '+a
p.filename_suffix=a
self._generate_figure(p)
开发者ID:KeithRobertson,项目名称:topographica,代码行数:34,代码来源:pylabplot.py
示例9: plot_transform
def plot_transform(X):
pylab.ion()
pylab.figure()
pylab.imshow(scipy.log(X.T), origin='lower', aspect='auto', interpolation='nearest', norm=matplotlib.colors.Normalize())
pylab.xlabel('Window index')
pylab.ylabel('Transform coefficient')
pylab.ioff()
开发者ID:jdkizer9,项目名称:SignalProcessingHW1,代码行数:7,代码来源:task3.py
示例10: plotChromosome
def plotChromosome(DF, fname=None, colors=['black', 'gray'], markerSize=20, ylim=None, show=True, scale=3):
if not show:
plt.ioff()
if 'POS' not in DF.columns:
df=DF.reset_index()
else:
df=DF
def plotOne(b, d, name):
a = b.dropna()
c = d.loc[a.index]
plt.scatter(a.index, a, s=markerSize, c=c, alpha=0.8, edgecolors='none')
th = a.mean() + scale * a.std()
outliers = a[a > th]
# outliers=findOutliers(a)
if len(outliers):
plt.scatter(outliers.index, outliers, s=markerSize, c='r', alpha=0.8, edgecolors='none')
plt.axhline(th, color='blue')
plt.axis('tight');
# plt.xlim(0, a.index[-1]);
plt.ylabel(name)
# plt.setp(plt.gca().get_xticklabels(), visible=False)
if ylim is not None: plt.ylim(ymin=ylim)
df['gpos'] = df.POS
df['color'] = 'gray'
df.set_index('gpos', inplace=True);
df.sort_index(inplace=True)
plt.figure(figsize=(24, 16), dpi=60);
# plt.subplot(3,1,1)
df.color='g'
plotOne(df.icol(1), df.color, 'COMALE')
df.color='b'
plotOne(df.icol(2), df.color, 'COMALE')
开发者ID:airanmehr,项目名称:bio,代码行数:33,代码来源:Plots.py
示例11: arrange_figures
def arrange_figures(layout=None, screen=2, xgap=10,
ygap=30, offset=0, figlist=None):
"""Automatiskt arrangera alla figurer i ett icke overlappande
monster
*layout*
Anvands inte just nu
*screen* [=2]
anger vilken skarm man i forsta hand vill ha fonstren pa.
*xgap*
Gap i x-led mellan fonster
*ygap*
Gap i y-led mellan fonster
*offset*
Nar skarmen ar fylld borjar man om fran ovre hogra hornet
men med en offset i x och y led.
*figlist*
Lista med figurnummer som skall arrangeras
"""
#Hamta information om total skarmbredd over alla anslutna skarmar
if not is_in_ipython():
return
# pylab.show()
pylab.ioff()
x0 = 0 + offset
y0 = 0 + offset
if screen == 2:
x0 = (pylab.get_current_fig_manager().window.winfo_screenwidth() +
offset)
if figlist is None:
figlist = sorted([x for x in Gcf.figs.items()])
x = x0
y = y0
maxheight = 0
while figlist:
fig = _, f = figlist[0]
figlist = figlist[1:]
if fig_fits_w(f, x):
move_fig(f, x, y)
x = x + f.window.winfo_width() + xgap
maxheight = max(maxheight, f.window.winfo_height())
else:
x = x0
y = y + maxheight + ygap
maxheight = 0
if fig_fits_h(f, y):
move_fig(f, x, y)
x = x + f.window.winfo_width() + xgap
else:
arrange_figures(offset=DELTAOFFSET, xgap=xgap, ygap=ygap,
screen=screen, figlist=[fig] + figlist)
break
pylab.ion()
开发者ID:arsenovic,项目名称:hftools,代码行数:60,代码来源:helper.py
示例12: main
def main(argv):
[ data_file ] = argv
pylab.ioff()
led_readings = {}
with open(data_file) as f:
for line in f:
record = json.loads(line)
leds = record['leds']
if (len(leds) == 1):
led = leds[0];
ts = record['timestamp'] / 1000.0
ts = datetime.fromtimestamp(ts).strftime('%d-%m-%Y %H:%M:%S')
if led not in led_readings:
led_readings[led] = {}
led_readings[led][ts] = record['light']
for led, readings in sorted(led_readings.items()):
ts = readings.keys()
photo_res_1 = [int(photo_res['0']) for photo_res in readings.values()]
x = range(len(ts))
pyplot.plot(x, photo_res_1)
pylab.xticks(x, ts, rotation=45)
pylab.savefig('/tmp/plots/' + str(led) + '_1.png')
开发者ID:evgeniyarbatov,项目名称:joy-of-coding,代码行数:32,代码来源:count.py
示例13: plot
def plot(self,pstyle="-"):
import pylab;
pfig=XpyFigure(pylab.gcf().number);
if isstring(pstyle):
pstyle=XyPlotStyle(pstyle);
i=0;
pylab.ioff();
#print "ioff"
for k in self.keys():
p=self[k];
if self.get('_datobj_title') is not None:
p['title']=self.get('_datobj_title');
#print "p type",type(p)
pstyle['linename']=k;
if i==0:
pstyle['showlabels']=True;
else:
pstyle['showlabels']=False;
p.plot(pstyle);
if i==0:
pylab.hold(True);
pstyle.nextplotstyle();
i=i+1;
pylab.ion();
pylab.grid(True);
stdout( "plotabledataobjtable:plot, done.")
开发者ID:charleseagle,项目名称:Data-Analysis-Software-Python,代码行数:28,代码来源:plotabledataobjtable.py
示例14: profile
def profile():
pylab.figure()
pylab.ion()
for i, ccol in enumerate(chart):
R, G, B, tX, tY, tZ = ccol
tx, ty = toxyY(tX, tY, tZ)
setAndroidColor(R, G, B)
X, Y, Z, x, y = getXYZxy()
print i, len(chart)
print R, G, B, tX, tY, tZ, X, Y, Z
pylab.plot(tx, ty, "go")
pylab.plot(x, y, "rx")
pylab.xlim([0, 0.8])
pylab.ylim([0, 0.9])
pylab.axis("scaled")
pylab.draw()
pylab.show()
pylab.ioff()
pylab.show()
开发者ID:rbrune,项目名称:hugdroid,代码行数:26,代码来源:hugdroid.py
示例15: promt
def promt(self, x, y):
p = Plot()
p.error(x, y, ecolor='0.3')
p.make()
pylab.ion()
p.show()
pylab.ioff()
print(' *** RANGE PICKER for "{}":'.format(self.id))
if RPicker.storage is not None and self.id in RPicker.storage:
r = RPicker.storage[self.id]
print(' previously from {:.5g} to {:.5g}'.format(r[0], r[1]))
xunit = p._xaxis.sprefunit()
lower = input(' lower limit ({}) = '.format(xunit))
upper = input(' upper limit ({}) = '.format(xunit))
print('')
lower = float(lower)
upper = float(upper)
f = Quantity(xunit) / Quantity(unit=x.uvec)
f = float(f)
lower *= f
upper *= f
if RPicker.storage is not None:
RPicker.storage[self.id] = (lower, upper)
print(' stored...')
return lower, upper
开发者ID:sauerburger,项目名称:ephys,代码行数:30,代码来源:analysis.py
示例16: train_kmeans
def train_kmeans(featurelearndata):
Rinit = numpy.random.permutation(numhid)
W = featurelearndata[Rinit]
for epoch in range(10):
W = online_kmeans.kmeans(featurelearndata, numhid, Winit=W, numepochs=10, learningrate=0.1*0.8**epoch)
W_ = numpy.dot(pca_forward,W.T).T.reshape(numhid, patchsize, patchsize, numchannels)
dispims_color.dispims_color(W_)
pylab.ion()
pylab.draw()
pylab.show()
pylab.ioff()
print "done"
allbigramfeatures = []
print "xxxxx",
for i, image in enumerate(allims):
print "\b\b\b\b\b\b{0:5d}".format(i),
image = image.reshape(numchannels, inputdim, inputdim).transpose(1,2,0)
prange = numpy.arange(patchsize/2, inputdim-patchsize/2)
meshg = numpy.meshgrid(prange, prange)
keypoints = numpy.array([c.flatten() for c in meshg]).T
patches = crop_patches_color(image, keypoints, patchsize)
patches -= patches.mean(1)[:,None]
patches /= patches.std(1)[:,None] + 0.1 * meanstd
patches = numpy.dot(patches, pca_backward.T).astype("float32")
if pooling==1:
allbigramfeatures.append(online_kmeans.assign_triangle(patches, W).mean(0).astype("float32"))
elif pooling==2:
quadrants = numpy.array([int(str(int(a[0]>=inputdim/2))+str(int(a[1]>=inputdim/2)), 2) for a in keypoints])
features = online_kmeans.assign_triangle(patches, W).astype("float32")
allbigramfeatures.append(numpy.array([(features * (quadrants==i)[:,None]).mean(0) for i in range(4)]).reshape(4*numhid))
return allbigramfeatures
开发者ID:capybaralet,项目名称:current,代码行数:31,代码来源:my2_cifar_classification_bigrams.py
示例17: plot_graph
def plot_graph(gng, iter, fig):
lines = []
for e in gng.graph.edges:
x0, y0 = e.head.data.pos
c0 = x[int(y0), int(x0)]<0.5 and bg_color or fg_color
x1, y1 = e.tail.data.pos
c1 = x[int(y1), int(x1)]<0.5 and bg_color or fg_color
# determine edge color
cline = c0==c1 and c0 or bg_color
lines.extend(([x0,x1], [y0,y1], cline+'-',
[x0,x0], [y0,y0], c0+'.',
[x1,x1], [y1,y1], c1+'.'))
fig.clf()
pylab.ioff()
# the order of the axis command is important!
fig.add_axes([0.01,0.01,0.98,0.98])
pylab.axis('scaled')
#pylab.plot(data[:,0], data[:,1], "k.")
pylab.plot(linewidth=2, ms=14, *lines)
pylab.axis([0,x.shape[1],0,x.shape[0]])
pylab.axis('off')
pylab.draw()
if save:
#fig = pylab.gcf()
fig.frameon = not transparent
pylab.savefig('animation/img'+('%d'%iter).zfill(4)+'.png',dpi=dpi)
fig.frameon = True
pylab.ion()
开发者ID:akatumba,项目名称:mdp-docs,代码行数:29,代码来源:gen_logo.py
示例18: chart
def chart(idx, a, b, label, FILE):
pylab.ioff()
fig_width_pt = 350 # Get this from LaTeX using \showthe\columnwidth
inches_per_pt = 1.0/72.27 # Convert pt to inch
golden_mean = ((5**0.5)-1.0)/2.0 # Aesthetic ratio
fig_width = fig_width_pt*inches_per_pt # width in inches
fig_height = fig_width*golden_mean # height in inches
fig_size = [fig_width*0.42,fig_height]
params = { 'backend': 'ps',
'axes.labelsize': 10,
'text.fontsize': 10,
'legend.fontsize': 10,
'xtick.labelsize': 8,
'ytick.labelsize': 8,
'text.usetex': True,
'figure.figsize': fig_size }
pylab.rcParams.update(params)
home = '/home/nealbob'
folder = '/Dropbox/Thesis/IMG/chapter3/'
img_ext = '.pdf'
pylab.figure()
pylab.boxplot(idx, whis=100)
pylab.ylim(a, b)
#pylab.ylabel(label)
pylab.tick_params(axis='x', which = 'both', labelbottom='off')
pylab.savefig(home + folder + FILE + img_ext)
pylab.show()
开发者ID:nealbob,项目名称:regrivermod,代码行数:31,代码来源:chart3.py
示例19: scan
def scan():
pylab.ion()
pylab.figure(1)
with Communicate('', None, debug=True) as serial:
serial.timeout = 0.0001
camera = Camera()
camera.setupmeasure()
controller = Controller(serial)
controller.setupscan()
out = []
for x,y in controller.scan():
camera.update()
camera.interact()
z = camera.measure()
out.append([x,y,z])
if camera.status == 'quit':
break
camera.show()
if len(out) > 0:
pylab.cla()
tmp = zip(*out)
sc = pylab.scatter(tmp[0],tmp[1],s=tmp[2], c=tmp[2], vmin=0, vmax=400)
print '{: 8.3f} {: 8.3f} {: 8.3f}'.format(x,y,z)
pylab.ioff()
pylab.show()
开发者ID:bkurtz,项目名称:PyGRBL,代码行数:33,代码来源:orient.py
示例20: init_plots
def init_plots():
try: matplotlib
except NameError: import matplotlib
'''
Sets plotting defaults to make things pretty
'''
pylab.ioff()
matplotlib.rcParams['lines.markeredgewidth'] = .001
matplotlib.rcParams['lines.linewidth']=2
matplotlib.rcParams['patch.edgecolor']='grey'
matplotlib.rcParams['font.size']=15.0
matplotlib.rcParams['figure.figsize']=14,12
matplotlib.rcParams['figure.subplot.left']=.1
matplotlib.rcParams['figure.subplot.right']=.9
matplotlib.rcParams['figure.subplot.top']=.92
matplotlib.rcParams['figure.subplot.bottom']=.1
matplotlib.rcParams['figure.subplot.wspace']=.2
matplotlib.rcParams['figure.subplot.hspace']=.2
matplotlib.rcParams['figure.facecolor']='white'
matplotlib.rcParams['axes.facecolor']='white'
matplotlib.rcParams['axes.edgecolor']='black'
matplotlib.rcParams['axes.linewidth']=1
matplotlib.rcParams['axes.grid']=False
matplotlib.rcParams['xtick.major.size']=7
matplotlib.rcParams['ytick.major.size']=7
matplotlib.rcParams['xtick.minor.size']=4
matplotlib.rcParams['ytick.minor.size']=4
开发者ID:justincely,项目名称:classwork,代码行数:27,代码来源:gravity.py
注:本文中的pylab.ioff函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论