Python matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg() Examples

The following are 30 code examples of matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module matplotlib.backends.backend_qt5agg , or try the search function .
Example #1
Source File: plotter.py    From visma with GNU General Public License v3.0 7 votes vote down vote up
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 
Example #2
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #3
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #4
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #5
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #6
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,UpWidget): 
        super(MyFigureCanvas, self).__init__(UpWidget)
        self.figure = plt.figure(0)
        self.canvas = FigureCanvas(self.figure)

        self.layout = QtWidgets.QGridLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        # self.lineNumber = 0
        self.numberOfRows = 1 #图片个数 (排列行数)
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20

        self.iheight = self.height()
        self.iwidth = self.width() 
Example #7
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #8
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #9
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #10
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #11
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #12
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #13
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #14
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #15
Source File: plot.py    From evo with GNU General Public License v3.0 6 votes vote down vote up
def tabbed_qt4_window(self):
        from PyQt4 import QtGui
        from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg, NavigationToolbar2QT
        # mpl backend can already create instance
        # https://stackoverflow.com/a/40031190
        app = QtGui.QApplication.instance()
        if app is None:
            app = QtGui.QApplication([self.title])
        self.root_window = QtGui.QTabWidget()
        self.root_window.setWindowTitle(self.title)
        for name, fig in self.figures.items():
            tab = QtGui.QWidget(self.root_window)
            tab.canvas = FigureCanvasQTAgg(fig)
            vbox = QtGui.QVBoxLayout(tab)
            vbox.addWidget(tab.canvas)
            toolbar = NavigationToolbar2QT(tab.canvas, tab)
            vbox.addWidget(toolbar)
            tab.setLayout(vbox)
            for axes in fig.get_axes():
                if isinstance(axes, Axes3D):
                    # must explicitly allow mouse dragging for 3D plots
                    axes.mouse_init()
            self.root_window.addTab(tab, name)
        self.root_window.show()
        app.exec_() 
Example #16
Source File: plot.py    From evo with GNU General Public License v3.0 6 votes vote down vote up
def tabbed_qt5_window(self):
        from PyQt5 import QtGui, QtWidgets
        from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT
        # mpl backend can already create instance
        # https://stackoverflow.com/a/40031190
        app = QtGui.QGuiApplication.instance()
        if app is None:
            app = QtWidgets.QApplication([self.title])
        self.root_window = QtWidgets.QTabWidget()
        self.root_window.setWindowTitle(self.title)
        for name, fig in self.figures.items():
            tab = QtWidgets.QWidget(self.root_window)
            tab.canvas = FigureCanvasQTAgg(fig)
            vbox = QtWidgets.QVBoxLayout(tab)
            vbox.addWidget(tab.canvas)
            toolbar = NavigationToolbar2QT(tab.canvas, tab)
            vbox.addWidget(toolbar)
            tab.setLayout(vbox)
            for axes in fig.get_axes():
                if isinstance(axes, Axes3D):
                    # must explicitly allow mouse dragging for 3D plots
                    axes.mouse_init()
            self.root_window.addTab(tab, name)
        self.root_window.show()
        app.exec_() 
Example #17
Source File: plot_waveform_rt.py    From BORIS with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self):
        super().__init__()

        self.interval = 60 # interval of visualization (in seconds)
        self.time_mem = -1

        self.cursor_color = "red"

        self.figure = Figure()

        self.canvas = FigureCanvas(self.figure)
        layout = QVBoxLayout()

        layout.addWidget(self.canvas)
        self.setLayout(layout)

        self.installEventFilter(self) 
Example #18
Source File: customqtwidgets.py    From Openroast with GNU General Public License v3.0 6 votes vote down vote up
def create_graph(self):
        # Create the graph widget.
        graphWidget = QtWidgets.QWidget()
        graphWidget.setObjectName("graph")

        # Style attributes of matplotlib.
        matplotlib.rcParams['lines.linewidth'] = 3
        matplotlib.rcParams['lines.color'] = '#2a2a2a'
        matplotlib.rcParams['font.size'] = 10.
        self.graphFigure = Figure(facecolor='#444952')
        self.graphCanvas = FigureCanvas(self.graphFigure)

        # Add graph widgets to layout for graph.
        graphVerticalBox = QtWidgets.QVBoxLayout()
        graphVerticalBox.addWidget(self.graphCanvas)
        graphWidget.setLayout(graphVerticalBox)

        # Animate the the graph with new data
        if self.animated:
            self.animateGraph = animation.FuncAnimation(self.graphFigure,
                self.graph_draw, interval=1000)
        else:
            self.graph_draw()

        return graphWidget 
Example #19
Source File: main.py    From python-examples with MIT License 6 votes vote down vote up
def __init__(self, parent=None):
        super(Mainwindow, self).__init__(parent)

        centralWidget = QWidget()
        self.setCentralWidget(centralWidget)
        self.fig = Figure()
        self.axes = self.fig.add_subplot(111)
        self.canvas = FigureCanvas(self.fig)
        self.gridLayout = QGridLayout(centralWidget)
        self.gridLayout.addWidget(self.canvas)   
        self.btn_plot = QCheckBox("Plot")
        self.btn_line = QCheckBox("Line")
        self.gridLayout.addWidget(self.btn_plot, 1,0,1,1)
        self.gridLayout.addWidget(self.btn_line, 2,0,1,1)
        self.btn_plot.clicked.connect(self.btnPlot)
        self.btn_line.clicked.connect(self.btnLine)

        self.Graphics = Graphics(self.axes) 
Example #20
Source File: plot.py    From evo_slam with GNU General Public License v3.0 6 votes vote down vote up
def tabbed_qt4_window(self):
        from PyQt4 import QtGui
        from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg, NavigationToolbar2QT
        # mpl backend can already create instance
        # https://stackoverflow.com/a/40031190
        app = QtGui.QApplication.instance()
        if app is None:
            app = QtGui.QApplication([self.title])
        self.root_window = QtGui.QTabWidget()
        self.root_window.setWindowTitle(self.title)
        for name, fig in self.figures.items():
            tab = QtGui.QWidget(self.root_window)
            tab.canvas = FigureCanvasQTAgg(fig)
            vbox = QtGui.QVBoxLayout(tab)
            vbox.addWidget(tab.canvas)
            toolbar = NavigationToolbar2QT(tab.canvas, tab)
            vbox.addWidget(toolbar)
            tab.setLayout(vbox)
            for axes in fig.get_axes():
                if isinstance(axes, Axes3D):
                    # must explicitly allow mouse dragging for 3D plots
                    axes.mouse_init()
            self.root_window.addTab(tab, name)
        self.root_window.show()
        app.exec_() 
Example #21
Source File: plot.py    From evo_slam with GNU General Public License v3.0 6 votes vote down vote up
def tabbed_qt5_window(self):
        from PyQt5 import QtGui, QtWidgets
        from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT
        # mpl backend can already create instance
        # https://stackoverflow.com/a/40031190
        app = QtGui.QGuiApplication.instance()
        if app is None:
            app = QtWidgets.QApplication([self.title])
        self.root_window = QtWidgets.QTabWidget()
        self.root_window.setWindowTitle(self.title)
        for name, fig in self.figures.items():
            tab = QtWidgets.QWidget(self.root_window)
            tab.canvas = FigureCanvasQTAgg(fig)
            vbox = QtWidgets.QVBoxLayout(tab)
            vbox.addWidget(tab.canvas)
            toolbar = NavigationToolbar2QT(tab.canvas, tab)
            vbox.addWidget(toolbar)
            tab.setLayout(vbox)
            for axes in fig.get_axes():
                if isinstance(axes, Axes3D):
                    # must explicitly allow mouse dragging for 3D plots
                    axes.mouse_init()
            self.root_window.addTab(tab, name)
        self.root_window.show()
        app.exec_() 
Example #22
Source File: pandapower_gui.py    From pandapower_gui with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def embedCollectionsBuilder(self):
        self.dpi = 100
        self.fig = plt.Figure()
        self.canvas = FigureCanvas(self.fig)
        self.ax = self.fig.add_subplot(111)
#        self.ax.set_axis_bgcolor("white")
        # when a button is pressed on the canvas?
        self.canvas.mpl_connect('button_press_event', self.onCollectionsClick)
        #self.canvas.mpl_connect('button_release_event', self.onCollectionsClick)
        self.canvas.mpl_connect('pick_event', self.onCollectionsPick)
        mpl_toolbar = NavigationToolbar(self.canvas, self.main_build_frame)
        self.gridLayout.addWidget(self.canvas)
        self.gridLayout.addWidget(mpl_toolbar)
        self.fig.subplots_adjust(
            left=0.0, right=1, top=1, bottom=0, wspace=0.02, hspace=0.04)
        self.dragged = None 
Example #23
Source File: demo_label.py    From openpose-pytorch with GNU Lesser General Public License v3.0 6 votes vote down vote up
def __init__(self, name, image, feature, alpha=0.5):
        super(Visualizer, self).__init__()
        self.name = name
        self.image = image
        self.feature = feature
        self.draw_feature = utils.visualize.DrawFeature(alpha)
        
        layout = QtWidgets.QVBoxLayout(self)
        fig = plt.Figure()
        self.ax = fig.gca()
        self.canvas = qtagg.FigureCanvasQTAgg(fig)
        layout.addWidget(self.canvas)
        toolbar = qtagg.NavigationToolbar2QT(self.canvas, self)
        layout.addWidget(toolbar)
        self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)
        self.slider.setRange(0, feature.shape[0] - 1)
        layout.addWidget(self.slider)
        self.slider.valueChanged[int].connect(self.on_progress)
        
        self.ax.imshow(self.image)
        self.ax.set_xticks([])
        self.ax.set_yticks([])
        self.on_progress(0) 
Example #24
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #25
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #26
Source File: MyFigureCanvas.py    From DeepLearning_Wavelet-LSTM with MIT License 6 votes vote down vote up
def __init__(self,figureNumber): 
        super(MyFigureCanvas, self).__init__()
        
        ''' 严重警告: self.figure = plt.figure( 0 ) 0是指定全局标识 '''
        self.figureNumber = figureNumber
        self.figure = plt.figure(self.figureNumber)

        self.canvas = FigureCanvas(self.figure)
        
        self.layout = QtWidgets.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0) #设置总的外围边框
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        self.axList = []

        self.numberOfRows = 1 #图片个数 (排列行数),默认为 1
        self.leftMargin = 40
        self.topMargin = 5
        self.rightMargin = 5
        self.bottomMargin = 20 
Example #27
Source File: abstract_main_window.py    From peakonly with MIT License 6 votes vote down vote up
def __init__(self):
        super().__init__()

        self._thread_pool = QtCore.QThreadPool()
        self._pb_list = ProgressBarsList(self)

        self._list_of_files = FileListWidget()

        self._list_of_features = FeatureListWidget()
        self._feature_parameters = None

        self._figure = plt.figure()
        self._ax = self._figure.add_subplot(111)  # plot here
        self._ax.set_xlabel('Retention time [min]')
        self._ax.set_ylabel('Intensity')
        self._ax.ticklabel_format(axis='y', scilimits=(0, 0))
        self._label2line = dict()  # a label (aka line name) to plotted line
        self._canvas = FigureCanvas(self._figure)
        self._toolbar = NavigationToolbar(self._canvas, self) 
Example #28
Source File: qsolver.py    From visma with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #29
Source File: plotter.py    From visma with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #30
Source File: steps.py    From visma with GNU General Public License v3.0 6 votes vote down vote up
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