当前位置: 首页>>代码示例>>Python>>正文


Python pylab.ioff方法代码示例

本文整理汇总了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) 
开发者ID:spacetelescope,项目名称:pysynphot,代码行数:22,代码来源:doscalars.py

示例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() 
开发者ID:DeniseCaiLab,项目名称:minian,代码行数:20,代码来源:plot.py

示例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() 
开发者ID:pyiron,项目名称:pyiron,代码行数:35,代码来源:gui.py

示例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() 
开发者ID:Spinmob,项目名称:spinmob,代码行数:31,代码来源:_pylab_tweaks.py

示例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() 
开发者ID:ActiveState,项目名称:code,代码行数:12,代码来源:recipe-576501.py

示例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() 
开发者ID:ActiveState,项目名称:code,代码行数:17,代码来源:recipe-576501.py

示例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) 
开发者ID:po0ya,项目名称:face-magnet,代码行数:41,代码来源:util.py

示例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() 
开发者ID:landlab,项目名称:landlab,代码行数:10,代码来源:celllab_cts.py

示例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. 
开发者ID:kdart,项目名称:pycopia,代码行数:53,代码来源:dataplots.py

示例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() 
开发者ID:Spinmob,项目名称:spinmob,代码行数:57,代码来源:_plotting_mess.py


注:本文中的pylab.ioff方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。