當前位置: 首頁>>代碼示例>>Python>>正文


Python figure.Figure方法代碼示例

本文整理匯總了Python中matplotlib.figure.Figure方法的典型用法代碼示例。如果您正苦於以下問題:Python figure.Figure方法的具體用法?Python figure.Figure怎麽用?Python figure.Figure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib.figure的用法示例。


在下文中一共展示了figure.Figure方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __setup_plot

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def __setup_plot(self):
        figure = Figure(facecolor='lightgrey')

        self._axes = figure.add_subplot(111)
        self._axes.set_title('Spectrum')
        self._axes.set_xlabel('Frequency (MHz)')
        self._axes.set_ylabel('Level (dB)')
        self._axes.autoscale_view(True, True, True)
        self._axes.grid(True)

        self._spectrum, = self._axes.plot([], [], 'b-', label='Spectrum')

        self._canvas = FigureCanvas(self._panelPlot, -1, figure)
        self._canvas.mpl_connect('motion_notify_event', self.__on_motion)

        Legend.__init__(self, self._axes, self._canvas) 
開發者ID:EarToEarOak,項目名稱:RF-Monitor,代碼行數:18,代碼來源:dialog_spectrum.py

示例2: __setup_plot

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def __setup_plot(self):
        figure = Figure(facecolor='lightgrey')

        self._axes = figure.add_subplot(111)
        self._axes.set_title('Timeline')
        self._axes.set_xlabel('Time')
        self._axes.set_ylabel('Frequency (MHz)')
        self._axes.grid(True)

        locator = AutoDateLocator()
        formatter = AutoDateFormatter(locator)
        self._axes.xaxis.set_major_formatter(formatter)
        self._axes.xaxis.set_major_locator(locator)
        formatter = ScalarFormatter(useOffset=False)
        self._axes.yaxis.set_major_formatter(formatter)
        self._axes.yaxis.set_minor_locator(AutoMinorLocator(10))

        self._canvas = FigureCanvas(self._panelPlot, -1, figure)
        self._canvas.mpl_connect('motion_notify_event', self.__on_motion)

        Legend.__init__(self, self._axes, self._canvas) 
開發者ID:EarToEarOak,項目名稱:RF-Monitor,代碼行數:23,代碼來源:dialog_timeline.py

示例3: __init__

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def __init__(self, parent=None, title='', xlabel='', ylabel='',
                 xlim=None, ylim=None, xscale='linear', yscale='linear',
                 width=4, height=3, dpi=100, hold=False):
        self.figure = Figure(figsize=(width, height), dpi=dpi)
        self.axes = self.figure.add_subplot(111)
        self.axes.set_title(title)
        self.axes.set_xlabel(xlabel)
        self.axes.set_ylabel(ylabel)
        if xscale is not None:
            self.axes.set_xscale(xscale)
        if yscale is not None:
            self.axes.set_yscale(yscale)
        if xlim is not None:
            self.axes.set_xlim(*xlim)
        if ylim is not None:
            self.axes.set_ylim(*ylim)
        self.axes.hold(hold)

        Canvas.__init__(self, self.figure)
        self.setParent(parent)

        Canvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding)
        Canvas.updateGeometry(self) 
開發者ID:swharden,項目名稱:Python-GUI-examples,代碼行數:25,代碼來源:matplotlibwidget.py

示例4: make_figure_window

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def make_figure_window(self):
        self.figure_window = tk.Toplevel(self)
        self.figure_window.wm_title('Preview')
        screen_dpi = self.figure_window.winfo_fpixels('1i')
        screen_width = self.figure_window.winfo_screenwidth()  # in pixels
        figure_width = screen_width / 2 / screen_dpi
        figure_height = 0.75 * figure_width
        self.figure = Figure(figsize=(figure_width, figure_height),
                             dpi=screen_dpi)
        ax0 = self.figure.add_subplot(221)
        axes = [self.figure.add_subplot(220 + i, sharex=ax0, sharey=ax0)
                for i in range(2, 5)]
        self.axes = np.array([ax0] + axes)
        canvas = FigureCanvasTkAgg(self.figure, master=self.figure_window)
        canvas.show()
        canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)
        toolbar = NavigationToolbar2Tk(canvas, self.figure_window)
        toolbar.update()
        canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1) 
開發者ID:jni,項目名稱:skan,代碼行數:21,代碼來源:gui.py

示例5: _format_scalarmappable_value

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def _format_scalarmappable_value(artist, idx):  # matplotlib/matplotlib#12473.
    data = artist.get_array()[idx]
    if np.ndim(data) == 0:
        if not artist.colorbar:
            fig = Figure()
            ax = fig.subplots()
            artist.colorbar = fig.colorbar(artist, cax=ax)
            # This hack updates the ticks without actually paying the cost of
            # drawing (RendererBase.draw_path raises NotImplementedError).
            try:
                ax.yaxis.draw(RendererBase())
            except NotImplementedError:
                pass
        fmt = artist.colorbar.formatter.format_data_short
        return "[" + _strip_math(fmt(data).strip()) + "]"
    else:
        return artist.format_cursor_data(data)  # Includes brackets. 
開發者ID:anntzer,項目名稱:mplcursors,代碼行數:19,代碼來源:_pick_info.py

示例6: qSolveFigure

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def qSolveFigure(workspace):
    """GUI layout for quick simplifier

    Arguments:
        workspace {QtWidgets.QWidget} -- main layout

    Returns:
        qSolLayout {QtWidgets.QVBoxLayout} -- quick simplifier layout
    """

    bg = workspace.palette().window().color()
    bgcolor = (bg.redF(), bg.greenF(), bg.blueF())
    workspace.qSolveFigure = Figure(edgecolor=bgcolor, facecolor=bgcolor)
    workspace.solcanvas = FigureCanvas(workspace.qSolveFigure)
    workspace.qSolveFigure.clear()
    qSolLayout = QtWidgets.QVBoxLayout()
    qSolLayout.addWidget(workspace.solcanvas)

    return qSolLayout 
開發者ID:aerospaceresearch,項目名稱:visma,代碼行數:21,代碼來源:qsolver.py

示例7: plotFigure2D

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def plotFigure2D(workspace):
    """GUI layout for plot figure

    Arguments:
        workspace {QtWidgets.QWidget} -- main layout

    Returns:
        layout {QtWidgets.QVBoxLayout} -- contains matplot figure
    """
    workspace.figure2D = Figure()
    workspace.canvas2D = FigureCanvas(workspace.figure2D)
    # workspace.figure2D.patch.set_facecolor('white')

    class NavigationCustomToolbar(NavigationToolbar):
        toolitems = [t for t in NavigationToolbar.toolitems if t[0] in ()]

    workspace.toolbar2D = NavigationCustomToolbar(workspace.canvas2D, workspace)
    layout = QVBoxLayout()
    layout.addWidget(workspace.canvas2D)
    layout.addWidget(workspace.toolbar2D)
    return layout 
開發者ID:aerospaceresearch,項目名稱:visma,代碼行數:23,代碼來源:plotter.py

示例8: plotFigure3D

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def plotFigure3D(workspace):
    """GUI layout for plot figure

    Arguments:
        workspace {QtWidgets.QWidget} -- main layout

    Returns:
        layout {QtWidgets.QVBoxLayout} -- contains matplot figure
    """
    workspace.figure3D = Figure()
    workspace.canvas3D = FigureCanvas(workspace.figure3D)
    # workspace.figure3D.patch.set_facecolor('white')

    class NavigationCustomToolbar(NavigationToolbar):
        toolitems = [t for t in NavigationToolbar.toolitems if t[0] in ()]

    workspace.toolbar3D = NavigationCustomToolbar(workspace.canvas3D, workspace)
    layout = QVBoxLayout()
    layout.addWidget(workspace.canvas3D)
    layout.addWidget(workspace.toolbar3D)
    return layout 
開發者ID:aerospaceresearch,項目名稱:visma,代碼行數:23,代碼來源:plotter.py

示例9: stepsFigure

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def stepsFigure(workspace):
    """GUI layout for step-by-step solution

    Arguments:
        workspace {QtWidgets.QWidget} -- main layout

    Returns:
        stepslayout {QtWidgets.QVBoxLayout} -- step-by-step solution layout
    """
    workspace.stepsfigure = Figure()
    workspace.stepscanvas = FigureCanvas(workspace.stepsfigure)
    workspace.stepsfigure.clear()
    workspace.scroll = QScrollArea()
    workspace.scroll.setWidget(workspace.stepscanvas)
    stepslayout = QVBoxLayout()
    stepslayout.addWidget(workspace.scroll)
    return stepslayout 
開發者ID:aerospaceresearch,項目名稱:visma,代碼行數:19,代碼來源:steps.py

示例10: __init__

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def __init__(self, parent, **kwargs):
        tk.Frame.__init__(self, parent, **kwargs)
        
        self.parent = parent
        self.degree = 5
        
        self.graphFigure = Figure(figsize=(4,2), dpi=100, facecolor="black")
        
        self.subplot = self.graphFigure.add_subplot(1,1,1, facecolor=(0.3, 0.3, 0.3))
        self.subplot.tick_params(axis="y", colors="grey", direction="in")
        self.subplot.tick_params(axis="x", colors="grey", labelbottom="off", bottom="off")
        
        self.graphFigure.axes[0].get_xaxis().set_ticklabels([])
        self.graphFigure.subplots_adjust(left=(30/100), bottom=(15/100), 
                                         right=1, top=(1-15/100), wspace=0, hspace=0)

        self.canvas = FigureCanvasTkAgg(self.graphFigure, self)
        self.canvas.get_tk_widget().configure(bg="black")
        self.canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)
        
        self.canvas.show() 
開發者ID:ArtificialQualia,項目名稱:PyEveLiveDPS,代碼行數:23,代碼來源:graph.py

示例11: makeGraph

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def makeGraph(self):
        self.graphFigure = Figure(figsize=(1,0.1), dpi=50, facecolor="black")
        
        self.subplot = self.graphFigure.add_subplot(1,1,1, facecolor=(0.3, 0.3, 0.3))
        self.subplot.tick_params(axis="y", colors="grey", labelbottom="off", bottom="off")
        self.subplot.tick_params(axis="x", colors="grey", labelbottom="off", bottom="off")
        
        self.graphFigure.axes[0].get_xaxis().set_ticklabels([])
        self.graphFigure.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)

        self.graphCanvas = FigureCanvasTkAgg(self.graphFigure, self)
        self.graphCanvas.get_tk_widget().configure(bg="black")
        self.graphCanvas.get_tk_widget().grid(row="2", column="2", columnspan="3", sticky="news")
        
        yValues = self.mainWindow.characterDetector.playbackLogReader.logEntryFrequency
        self.highestValue = 0
        for value in yValues:
            if value > self.highestValue: self.highestValue = value
        self.subplot.plot(yValues, "dodgerblue")
        self.timeLine, = self.subplot.plot([0, 0], [0, self.highestValue], "white")
        #self.graphFigure.axes[0].set_xlim(0, len(yValues))
        self.subplot.margins(0.005,0.01)
        
        self.graphCanvas.show()
        self.mainWindow.makeDraggable(self.graphCanvas.get_tk_widget()) 
開發者ID:ArtificialQualia,項目名稱:PyEveLiveDPS,代碼行數:27,代碼來源:playbackFrame.py

示例12: __init__

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def __init__(self, parent=None, width=5, height=4, dpi=100):
        fig = Figure(figsize=(width, height), dpi=dpi)
        self.axes = fig.add_subplot(111)
        # We want the axes cleared every time plot() is called
        self.axes.hold(False)

        self.compute_initial_figure()

        #
        FigureCanvas.__init__(self, fig)
        self.setParent(parent)

        FigureCanvas.setSizePolicy(self,
                                   QtGui.QSizePolicy.Expanding,
                                   QtGui.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self) 
開發者ID:ocelot-collab,項目名稱:ocelot,代碼行數:18,代碼來源:sim_gui.py

示例13: view

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def view(self, figsize=(5, 5)) -> Tuple[Figure, AxesImage]:
        """View the current state of the board

        Parameters
        ----------
        figsize : tuple
            Size of the output figure

        Returns
        -------
        (:obj:`matplotlib.figure.Figure`, :obj:`matplotlib.image.AxesImage`)
            Graphical view of the board
        """
        fig = plt.figure(figsize=figsize)
        ax = fig.add_axes([0, 0, 1, 1], xticks=[], yticks=[], frameon=False)
        im = ax.imshow(self.state, cmap=plt.cm.binary, interpolation="nearest")
        im.set_clim(-0.05, 1)
        return fig, im 
開發者ID:ljvmiranda921,項目名稱:seagull,代碼行數:20,代碼來源:board.py

示例14: view

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def view(self, figsize=(5, 5)) -> Tuple[Figure, AxesImage]:
        """View the lifeform


        Returns
        -------
        matplotlib.axes._subplots.AxesSubplot
            Graphical view of the lifeform
        """
        fig = plt.figure(figsize=figsize)
        ax = fig.add_axes([0, 0, 1, 1], xticks=[], yticks=[], frameon=False)
        im = ax.imshow(
            self.layout, cmap=plt.cm.binary, interpolation="nearest"
        )
        im.set_clim(-0.05, 1)
        return fig, im 
開發者ID:ljvmiranda921,項目名稱:seagull,代碼行數:18,代碼來源:base.py

示例15: savefig

# 需要導入模塊: from matplotlib import figure [as 別名]
# 或者: from matplotlib.figure import Figure [as 別名]
def savefig(self, figure=None, **kwargs):
        """
        Save the Figure instance *figure* to this file as a new page.
        If *figure* is a number, the figure instance is looked up by
        number, and if *figure* is None, the active figure is saved.
        Any other keyword arguments are passed to Figure.savefig.
        """
        if isinstance(figure, Figure):
            figure.savefig(self, format='pdf', **kwargs)
        else:
            if figure is None:
                figureManager = Gcf.get_active()
            else:
                figureManager = Gcf.get_fig_manager(figure)
            if figureManager is None:
                raise ValueError("No such figure: " + repr(figure))
            else:
                figureManager.canvas.figure.savefig(self, format='pdf', **kwargs) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:20,代碼來源:backend_pdf.py


注:本文中的matplotlib.figure.Figure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。