本文整理匯總了Python中pylab.ioff方法的典型用法代碼示例。如果您正苦於以下問題:Python pylab.ioff方法的具體用法?Python pylab.ioff怎麽用?Python pylab.ioff使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pylab
的用法示例。
在下文中一共展示了pylab.ioff方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: plotdata
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import ioff [as 別名]
def plotdata(obsmode,spectrum,val,odict,sdict,
instr,fieldname,outdir,outname):
isetting=P.isinteractive()
P.ioff()
P.clf()
P.plot(obsmode,val,'.')
P.ylabel('(pysyn-syn)/syn')
P.xlabel('obsmode')
P.title("%s: %s"%(instr,fieldname))
P.savefig(os.path.join(outdir,outname+'_obsmode.ps'))
P.clf()
P.plot(spectrum,val,'.')
P.ylabel('(pysyn-syn)/syn')
P.xlabel('spectrum')
P.title("%s: %s"%(instr,fieldname))
P.savefig(os.path.join(outdir,outname+'_spectrum.ps'))
matplotlib.interactive(isetting)
示例2: plot_components
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import ioff [as 別名]
def plot_components(a, c, dims, savepath=''):
try:
a = a.reshape(np.append(dims, -1), order='F')
except NotImplementedError:
a = a.toarray().reshape(np.append(dims, -1), order='F')
if savepath:
pl.ioff()
for cmp_id, temp_sig in enumerate(c):
fig = pl.figure()
ax_a = fig.add_subplot(211)
ax_c = fig.add_subplot(212)
ax_a.imshow(a[:, :, cmp_id])
ax_c.plot(temp_sig)
fig.suptitle("component " + str(cmp_id))
if savepath:
fig.savefig(savepath + "component_" + str(cmp_id) + '.svg')
print("saving component " + str(cmp_id))
pl.ion()
示例3: plot_array
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import ioff [as 別名]
def plot_array(self, val):
"""
Args:
val:
Returns:
"""
try:
import pylab as plt
except ImportError:
import matplotlib.pyplot as plt
plt.ioff()
if self.fig is None:
self.fig, self.ax = plt.subplots()
else:
self.ax.clear()
# self.ax.set_title(self.name)
if val.ndim == 1:
self.ax.plot(val)
elif val.ndim == 2:
if len(val) == 1:
self.ax.plot(val[0])
else:
self.ax.plot(val)
elif val.ndim == 3:
self.ax.plot(val[:, :, 0])
# self.fig.canvas.draw()
self.w_text.value = self.plot_to_html()
plt.close()
示例4: image_format_figure
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import ioff [as 別名]
def image_format_figure(figure=None, draw=True):
"""
This formats the figure in a compact way with (hopefully) enough useful
information for printing large data sets. Used mostly for line and scatter
plots with long, information-filled titles.
Chances are somewhat slim this will be ideal for you but it very well might
and is at least a good starting point.
figure=None specify a figure object. None will use gcf()
"""
_pylab.ioff()
if figure == None: figure = _pylab.gcf()
set_figure_window_geometry(figure, (0,0), (550,470))
axes = figure.axes[0]
# set up the title label
axes.title.set_horizontalalignment('right')
axes.title.set_size(8)
axes.title.set_position([1.27,1.02])
axes.title.set_visible(1)
if draw:
_pylab.ion()
_pylab.draw()
示例5: replotf
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import ioff [as 別名]
def replotf(self):
"""This replots the function given the coefficient array c."""
x = M.arange(-1,1.,.001)
M.ioff()
M.figure(self.ffig.number)
M.cla()
M.plot(x, f(x,self.c))
M.title(fstring(self.c))
M.draw()
示例6: replotc
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import ioff [as 別名]
def replotc(self):
"""This replots the coefficients."""
M.figure(self.cfig.number)
M.ioff()
for n in xrange(self.order-1):
M.axes(self.ax[n])
#M.cla()
M.plot([self.c[n]], [self.c[n+1]],'ko')
M.xlabel("$c_%d$" %(n))
M.ylabel("$c_%d$" %(n+1))
M.axis([-1, 1, -1, 1]);
del self.ax[n].lines[0]
M.draw()
示例7: drawDef
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import ioff [as 別名]
def drawDef(dfeat, dy, dx, mindef=0.001, distr="father"):
"""
auxiliary funtion to draw recursive levels of deformation
"""
from matplotlib.patches import Ellipse
pylab.ioff()
if distr == "father":
py = [0, 0, 2, 2]
px = [0, 2, 0, 2]
if distr == "child":
py = [0, 1, 1, 2]
px = [1, 2, 0, 1]
ordy = [0, 0, 1, 1]
ordx = [0, 1, 0, 1]
x1 = -0.5 + dx
x2 = 2.5 + dx
y1 = -0.5 + dy
y2 = 2.5 + dy
if distr == "father":
pylab.fill([x1, x1, x2, x2, x1], [y1, y2, y2, y1, y1],
"r", alpha=0.15, edgecolor="b", lw=1)
for l in range(len(py)):
aux = dfeat[ordy[l], ordx[l], :].clip(-1, -mindef)
wh = numpy.exp(-mindef / aux[0]) / numpy.exp(1)
hh = numpy.exp(-mindef / aux[1]) / numpy.exp(1)
e = Ellipse(
xy=[(px[l] + dx), (py[l] + dy)], width=wh, height=hh, alpha=0.35)
x1 = -0.75 + dx + px[l]
x2 = 0.75 + dx + px[l]
y1 = -0.76 + dy + py[l]
y2 = 0.75 + dy + py[l]
col = numpy.array([wh * hh] * 3).clip(0, 1)
if distr == "father":
col[0] = 0
e.set_facecolor(col)
pylab.gca().add_artist(e)
if distr == "father":
pylab.fill([x1, x1, x2, x2, x1], [y1, y2, y2, y1, y1],
"b", alpha=0.15, edgecolor="b", lw=1)
示例8: finalize
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import ioff [as 別名]
def finalize(self):
"""Wrap up plotting.
Wrap up plotting by switching off interactive model and showing
the plot.
"""
plt.ioff()
plt.show()
示例9: make_plots
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import ioff [as 別名]
def make_plots(dset, timemarks="0s,9d", ylim=None, columns=None,
autoscale=False, events=None, interactive=False):
pylab.ioff()
names = []
if type(events) is dataset.DataSet:
events.normalize_time(dset.measurements[0][0])
dset.normalize_time()
unit = dset.unit
for subset, start, end in dset.get_timeslices(timemarks):
if len(subset) > 0:
datacols, labels = subset.get_columns(columns)
x_time = datacols[0]
if len(x_time) < 100:
mrk = "."
ls = "-"
else:
mrk = ","
ls = "None"
for col, label, color in itertools.izip(datacols[1:], labels[1:], color_cycler):
pylab.plot(x_time, col, color=color, label=label, ls=ls, marker=mrk)
pylab.setp(pylab.gcf(), dpi=100, size_inches=(9,6))
pylab.xlabel("Time (s)")
pylab.ylabel(unit)
if events is not None:
ax = pylab.gca()
for row in events:
ax.axvline(row[0], color="rgbymc"[int(row[1]) % 6])
metadata = subset.metadata
title = "%s-%s-%s-%ss-%ss" % (metadata.name,
metadata.timestamp.strftime("%m%d%H%M%S"),
"-".join(labels),
int(start),
int(end))
pylab.title(title, fontsize="x-small")
font = FontProperties(size="x-small")
pylab.legend(prop=font)
if not interactive:
fname = "%s.%s" % (title, "png")
pylab.savefig(fname, format="png")
names.append(fname)
pylab.cla()
else:
break
return names
# Functions for interactive reporting from command line.
示例10: complex_data
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import ioff [as 別名]
def complex_data(data, edata=None, draw=True, **kwargs):
"""
Plots the imaginary vs real for complex data.
Parameters
----------
data
Array of complex data
edata=None
Array of complex error bars
draw=True
Draw the plot after it's assembled?
See spinmob.plot.xy.data() for additional optional keyword arguments.
"""
_pylab.ioff()
# generate the data the easy way
try:
rdata = _n.real(data)
idata = _n.imag(data)
if edata is None:
erdata = None
eidata = None
else:
erdata = _n.real(edata)
eidata = _n.imag(edata)
# generate the data the hard way.
except:
rdata = []
idata = []
if edata is None:
erdata = None
eidata = None
else:
erdata = []
eidata = []
for n in range(len(data)):
rdata.append(_n.real(data[n]))
idata.append(_n.imag(data[n]))
if not edata is None:
erdata.append(_n.real(edata[n]))
eidata.append(_n.imag(edata[n]))
if 'xlabel' not in kwargs: kwargs['xlabel'] = 'Real'
if 'ylabel' not in kwargs: kwargs['ylabel'] = 'Imaginary'
xy_data(rdata, idata, eidata, erdata, draw=False, **kwargs)
if draw:
_pylab.ion()
_pylab.draw()
_pylab.show()