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


Python FigureCanvasQTAgg.setMinimumHeight方法代码示例

本文整理汇总了Python中matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg.setMinimumHeight方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasQTAgg.setMinimumHeight方法的具体用法?Python FigureCanvasQTAgg.setMinimumHeight怎么用?Python FigureCanvasQTAgg.setMinimumHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg的用法示例。


在下文中一共展示了FigureCanvasQTAgg.setMinimumHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: one_dim_integrate

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setMinimumHeight [as 别名]
    def one_dim_integrate(self):
        """
        This creates the bottom left tile and also creates an instance of the IntegrationPlot class for handling
        the plotting of the image

        Parameters
        ----------
        self

        Returns
        -------
        None

        """
        figure = plt.figure()
        canvas = FigureCanvas(figure)
        FigureCanvas.setSizePolicy(canvas, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(canvas)
        canvas.setMinimumHeight(200)
        self.one_dim_plot = IntegrationPlot(self.int_data_dict, self.key_list, figure, canvas)
        toolbar = NavigationToolBar(canvas, self)
        layout = QtGui.QVBoxLayout()
        layout.addWidget(toolbar)
        layout.addWidget(canvas)
        self.display_box_2.addStretch()
        self.display_box_2.addLayout(layout)
开发者ID:idellasa,项目名称:xpdView,代码行数:28,代码来源:XPD_view_2.py

示例2: MainWin

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setMinimumHeight [as 别名]

#.........这里部分代码省略.........
        voi_val = int(self.voi_cbox.currentText())
        vhi_val = int(self.vhi_cbox.currentText())
        type_val = str(self.type_cbox.currentText())

        case = self.cas.cases[case_id]
        if type_val == 'CCl':
            idx0 = case.findpoint(tfu=293)
            voi = case.statepts[idx0].voi
            vhi = case.statepts[idx0].vhi
            voi_index = [i for i,v in enumerate(self.voilist) if int(v) == voi][0]
            vhi_index = [i for i,v in enumerate(self.vhilist) if int(v) == vhi][0]
            self.voi_cbox.setCurrentIndex(voi_index)
            self.vhi_cbox.setCurrentIndex(vhi_index)
        else:
            idx0 = case.findpoint(voi=voi_val,vhi=vhi_val)
        return idx0



    def create_main_frame(self):
        self.main_frame = QWidget()

        # Create the mpl Figure and FigCanvas objects. 
        # 5x4 inches, 100 dots-per-inch
        #
        self.dpi = 100
        self.fig = Figure((6, 5), dpi=self.dpi, facecolor=None)
        #self.fig = Figure((6, 5), dpi=self.dpi, facecolor=(1,1,1))
        self.canvas = FigureCanvas(self.fig)
        self.canvas.mpl_connect('button_press_event',self.on_click)
        self.canvas.setParent(self.main_frame)
        self.canvas.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
        self.canvas.setMinimumWidth(500)
        self.canvas.setMinimumHeight(416)
        
        cvbox = QVBoxLayout()
        cvbox.addWidget(self.canvas)
        canvasGbox = QGroupBox()
        canvasGbox.setStyleSheet("QGroupBox { background-color: rgb(200, 200,\
        200); border:1px solid gray; border-radius:5px;}")
        canvasGbox.setLayout(cvbox)

        # Since we have only one plot, we can use add_axes 
        # instead of add_subplot, but then the subplot
        # configuration tool in the navigation toolbar wouldn't
        # work.
        #
        self.axes = self.fig.add_subplot(111)
        
        # Bind the 'pick' event for clicking on one of the bars
        #
        #self.canvas.mpl_connect('pick_event', self.on_pick)
        
        # Create the navigation toolbar, tied to the canvas
        #
        #self.mpl_toolbar = NavigationToolbar(self.canvas, self.main_frame)

        # Other GUI controls
        # 
        #self.textbox = QLineEdit()
        #self.textbox.setMinimumWidth(200)
        #self.connect(self.textbox, SIGNAL('editingFinished ()'), self.on_draw)

                
        #self.draw_button = QPushButton("Draw")
        #self.connect(self.draw_button, SIGNAL('clicked()'), self.on_plot)
开发者ID:pgroning,项目名称:best,代码行数:70,代码来源:main_gui.py

示例3: StreamViewerWidget

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setMinimumHeight [as 别名]
class StreamViewerWidget(QtGui.QWidget):
    """Shows the entire signal and allows the user to navigate through it.

    Provides an scrollable selector over the entire signal.

    Attributes:
        xmin: Selector lower limit (measured in h-axis units).
        xmax: Selector upper limit (measured in h-axis units).
        step: Selector length (measured in h-axis units).
    """

    trace_selected = QtCore.Signal(int)
    selection_made = QtCore.Signal(bool)

    def __init__(self, parent, stream=None):
        super(StreamViewerWidget, self).__init__(parent)

        self.fig = plt.figure()
        self.canvas = FigureCanvas(self.fig)
        self.canvas.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Policy.Expanding,
                                                    QtGui.QSizePolicy.Policy.Expanding))
        self.canvas.setMinimumHeight(320)
        self.canvas.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.canvas.setFocus()
        self.graphArea = QtGui.QScrollArea(self)
        self.graphArea.setWidget(self.canvas)
        self.graphArea.setWidgetResizable(True)
        self.graphArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        # Set the layout
        self.layout = QtGui.QVBoxLayout(self)
        self.layout.addWidget(self.graphArea)

        # Animation related attrs.
        self.background = []
        self.animated = False
        self.size = (self.fig.bbox.width, self.fig.bbox.height)

        # Set TracePlot list
        self.trace_plots = []

        self.stream = None
        if stream is not None:
            self.set_stream(stream)

        # Event handling
        self.visible_axes = []
        self._selected_traces = set()
        self.shift_pressed = False
        self.press_selector = None
        self.fig.canvas.mpl_connect('motion_notify_event', self.on_move)
        self.fig.canvas.mpl_connect('button_press_event', self.on_press)
        self.fig.canvas.mpl_connect('key_press_event', self.on_key_press)
        self.fig.canvas.mpl_connect('key_release_event', self.on_key_release)

    @property
    def selected_traces(self):
        if self.stream is not None:
            return [self.stream.traces[i] for i in self._selected_traces]
        return []

    def on_move(self, event):
        axes_selected = False
        for i, axes in enumerate(self.fig.axes):
            if axes.get_visible():
                ymin, ymax = axes.get_position().ymin, axes.get_position().ymax
                xmin, xmax = axes.get_position().xmin, axes.get_position().xmax
                xfig, yfig = self._event_to_fig_coords(event)
                if ymin <= yfig <= ymax and xmin <= xfig <= xmax:
                    self.canvas.setToolTip(self.stream.traces[i].name)
                    axes_selected = True
                    break
        if not axes_selected:
            self.canvas.setToolTip("")

    def on_key_press(self, event):
        if event.key == 'control':
            self.shift_pressed = True

    def on_key_release(self, event):
        self.shift_pressed = False

    def on_press(self, event):
        trace_selected = False
        if event.button == 1:# and event.dblclick:
            for i, ax in enumerate(self.fig.axes):
                if ax.get_visible():
                    ymin, ymax = ax.get_position().ymin, ax.get_position().ymax
                    xmin, xmax = ax.get_position().xmin, ax.get_position().xmax
                    xfig, yfig = self._event_to_fig_coords(event)
                    if ymin <= yfig <= ymax and xmin <= xfig <= xmax:
                        trace_selected = True
                        if self.shift_pressed:
                            if self._selected_traces:
                                self.trace_selected.emit(i)
                                self.selection_made.emit(True)
                            self._selected_traces.add(i)
                        else:
                            self.trace_selected.emit(i)
                            self.selection_made.emit(True)
                            self._selected_traces = {i}
#.........这里部分代码省略.........
开发者ID:cageo,项目名称:Romero-2016,代码行数:103,代码来源:tsvwidget.py

示例4: SignalViewerWidget

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setMinimumHeight [as 别名]
class SignalViewerWidget(QtGui.QWidget):
    """Shows different visualizations of a seismic signal (magnitude, envelope,
    spectrogram, characteristic function).
    Allows the user to manipulate it (navigate through it, zoom in/out,
    edit detected events, select threshold value, etc...)

    """

    CF_loaded = QtCore.Signal(bool)
    event_selected = QtCore.Signal(rc.ApasvoEvent)

    def __init__(self, parent, document=None):
        super(SignalViewerWidget, self).__init__(parent)

        self.document = document
        self.xmin = 0.0
        self.xmax = 0.0
        self.xleft = 0.0
        self.xright = 0.0
        self.time = np.array([])

        self.fs = 0.0
        self.signal = None
        self.envelope = None
        self.cf = None
        self.time = None
        self._signal_data = None
        self._envelope_data = None
        self._cf_data = None

        self.fig, _ = plt.subplots(3, 1)

        self.signal_ax = self.fig.axes[0]
        self.cf_ax = self.fig.axes[1]
        self.specgram_ax = self.fig.axes[2]

        self.canvas = FigureCanvas(self.fig)
        self.canvas.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Policy.Expanding,
                                                    QtGui.QSizePolicy.Policy.Expanding))
        self.canvas.setMinimumHeight(320)
        self.graphArea = QtGui.QScrollArea(self)
        self.graphArea.setWidget(self.canvas)
        self.graphArea.setWidgetResizable(True)

        self.eventMarkers = {}
        self.last_right_clicked_event = None
        self.thresholdMarker = None
        self.playback_marker = None
        self.selector = SpanSelector(self.fig)
        self.minimap = MiniMap(self, self.signal_ax, None)

        # Load Spectrogram settings
        self.update_specgram_settings()

        # Animation related attributes
        self.background = None
        self.animated = False

        # Create context menus
        self.event_context_menu = QtGui.QMenu(self)
        self.takanami_on_event_action = QtGui.QAction("Apply Takanami to Event", self)
        self.takanami_on_event_action.setStatusTip("Refine event position by using Takanami algorithm")
        self.event_context_menu.addAction(self.takanami_on_event_action)
        self.takanami_on_event_action.triggered.connect(self.apply_takanami_to_selected_event)

        self.selection_context_menu = QtGui.QMenu(self)
        self.create_event_action = QtGui.QAction("Create New Event on Selection", self)
        self.create_event_action.setStatusTip("Create a new event on selection")
        self.takanami_on_selection_action = QtGui.QAction("Apply Takanami to Selection", self)
        self.takanami_on_selection_action.setStatusTip("Apply Takanami algorithm to selection")
        self.selection_context_menu.addAction(self.create_event_action)
        self.selection_context_menu.addAction(self.takanami_on_selection_action)
        self.create_event_action.triggered.connect(self.create_event_on_selection)
        self.takanami_on_selection_action.triggered.connect(self.apply_takanami_to_selection)

        # format axes
        formatter = FuncFormatter(lambda x, pos: clt.float_secs_2_string_date(x, self.document.record.starttime))
        for ax in self.fig.axes:
            ax.callbacks.connect('xlim_changed', self.on_xlim_change)
            ax.xaxis.set_major_formatter(formatter)
            plt.setp(ax.get_xticklabels(), visible=True)
            ax.grid(True, which='both')
        self.specgram_ax.callbacks.connect('ylim_changed', self.on_ylim_change)
        self.specgram_ax.set_xlabel('Time (seconds)')
        plt.setp(self.signal_ax.get_yticklabels(), visible=False)
        #self.signal_ax.set_ylabel('Signal Amp.')
        self.cf_ax.set_ylabel('CF Amp.')
        self.specgram_ax.set_ylabel('Frequency (Hz)')

        # Set the layout
        self.layout = QtGui.QVBoxLayout(self)
        self.layout.addWidget(self.graphArea)
        self.layout.addWidget(self.minimap)

        self.selector.toggled.connect(self.minimap.set_selection_visible)
        self.selector.valueChanged.connect(self.minimap.set_selection_limits)
        self.selector.right_clicked.connect(self.on_selector_right_clicked)

        if self.document is not None:
            self.set_record(document)
#.........这里部分代码省略.........
开发者ID:cageo,项目名称:Romero-2016,代码行数:103,代码来源:svwidget.py


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