def __init__(self, parent=None): super(MatplotlibWidget, self).__init__(parent) self.figure = Figure() self.canvas = FigureCanvasQTAgg(self.figure) self.figure.patch.set_facecolor((0.95, 0.94, 0.94, 1.)) self.axis = self.figure.add_subplot(111) self.axis.axis('off') self.layoutVertical = QtGui.QVBoxLayout(self) self.layoutVertical.addWidget(self.canvas)
def setFigure(self, fig): """Replace the current figure shown in the widget with fig""" plt.close(self.canvas.figure) new_canvas = FigureCanvasQTAgg(fig) self.layout.replaceWidget(self.canvas, new_canvas) new_toolbar = NavigationToolbar2QT(new_canvas, self) self.layout.replaceWidget(self.toolbar, new_toolbar) self.toolbar.setParent(None) self.toolbar = new_toolbar self.canvas = new_canvas
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) figure = Figure() fig_canvas = FigureCanvasQTAgg(figure) fig_toolbar = NavigationToolbar(fig_canvas, self) fig_vbox = QtGui.QVBoxLayout() fig_vbox.addWidget(fig_canvas) fig_vbox.addWidget(fig_toolbar) fig_canvas.setParent(self) fig_canvas.setFocusPolicy(QtCore.Qt.ClickFocus) fig_canvas.setFocus() self.setLayout(fig_vbox) self.figure = figure
def __createMatplotlibCanvas(self, plt_extent): fig = Figure( (1, 1), #tight_layout=True, linewidth=0.0, subplotpars=matplotlib.figure.SubplotParams(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)) #fig.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=None, hspace=None) #fig = Figure((24, 24), tight_layout=True) # try: # fig = Figure(tight_layout=True) # except: # #tight layout not available # fig = Figure() #fig = plt.figure() #fig.set_tight_layout(True) #font = {'family': 'arial', 'weight': 'normal', 'size': 12} #rc('font', **font) rect = fig.patch rect.set_facecolor((0.9, 0.9, 0.9)) # self.subplot = fig.add_axes( # #(0.08, 0.15, 0.92, 0.82), # (0.0, 0.0, 1.0, 1.0), # anchor='SW', # adjustable='box-forced' # ) #left bottom right top self.subplot = fig.add_axes( (LEFT_MARGIN, BOTTOM_MARGIN, RIGHT_MARGIN, TOP_MARGIN), adjustable='datalim', aspect=1) #self.subplot.plot.tight_layout(True) self.subplot.set_xbound(plt_extent.xmin, plt_extent.xmax) self.subplot.set_ybound(plt_extent.ymin, plt_extent.ymax) self.__setupAxes(self.subplot) #fig.tight_layout() canvas = FigureCanvasQTAgg(fig) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) canvas.setSizePolicy(sizePolicy) canvas.mpl_connect('pick_event', self.__plotPicked) canvas.mpl_connect('draw_event', self.__figureDrawn) canvas.mpl_connect('button_press_event', self.__buttonPressed) canvas.mpl_connect('motion_notify_event', self.__mouse_move) return canvas
def showIt(self): #QMessageBox.information(self.iface.mainWindow(), "DEBUG", "showIt()") self.layout = self.frame_for_plot.layout() minsize = self.minimumSize() maxsize = self.maximumSize() self.setMinimumSize(minsize) self.setMaximumSize(maxsize) self.iface.mapCanvas().setRenderFlag(True) # matlab figure self.artists = [] labels = [] fig = Figure((1.0, 1.0), linewidth=0.0, subplotpars=matplotlib.figure.SubplotParams(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)) font = {'family': 'arial', 'weight': 'normal', 'size': 12} rect = fig.patch rect.set_facecolor((0.9, 0.9, 0.9)) self.subplot = fig.add_axes((0.10, 0.15, 0.85, 0.82)) self.subplot.set_xbound(0, 1000) self.subplot.set_ybound(0, 1000) self.manageMatplotlibAxe(self.subplot) canvas = FigureCanvasQTAgg(fig) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) canvas.setSizePolicy(sizePolicy) self.plotWdg = canvas self.gridLayout.addWidget(self.plotWdg) #mpltoolbar = matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg(self.plotWdg, self.frame_for_plot) #create curve label = "test" x = numpy.linspace(-numpy.pi, numpy.pi, 201) y = numpy.sin(x) a, = self.subplot.plot(x, y) self.artists.append(a) labels.append(label) self.subplot.hold(True) self.plotWdg.draw()
def plot_roll_pitch(self): """ Wrzuca plot do zakladki w gui :return: """ if self.data_loaded: fig = self.visualizer.roll_time(False) fig2 = self.visualizer.pitch_time(False) self.tab_roll = QtGui.QWidget() self.tab_roll.setObjectName(_fromUtf8("dst")) self.tabWidget.addTab(self.tab_roll, _fromUtf8("Przechył boczny")) self.tabWidget.setCurrentWidget(self.tab_roll) layout = QtGui.QVBoxLayout() layout.addWidget(FigureCanvasQTAgg(fig)) self.tab_roll.setLayout(layout) self.tab_pitch = QtGui.QWidget() self.tab_pitch.setObjectName(_fromUtf8("dst")) self.tabWidget.addTab(self.tab_pitch, _fromUtf8("Kąt wznoszenia")) self.tabWidget.setCurrentWidget(self.tab_pitch) layout = QtGui.QVBoxLayout() layout.addWidget(FigureCanvasQTAgg(fig2)) self.tab_pitch.setLayout(layout)
def plot_path(self): """ Wrzuca plot do zakladki w gui :return: """ if self.data_loaded: fig = self.visualizer.position_time(True) self.tab_path = QtGui.QWidget() self.tab_path.setObjectName(_fromUtf8("dst")) self.tabWidget.addTab(self.tab_path, _fromUtf8("Tor lotu")) self.tabWidget.setCurrentWidget(self.tab_path) layout = QtGui.QVBoxLayout() layout.addWidget(FigureCanvasQTAgg(fig)) self.tab_path.setLayout(layout)
def plot_altitude(self): """ Wrzuca plot do zakladki w gui :return: """ if self.data_loaded: fig = self.visualizer.altitude_time(False) self.tab_alt = QtGui.QWidget() self.tab_alt.setObjectName(_fromUtf8("dst")) self.tabWidget.addTab(self.tab_alt, _fromUtf8("Wysokość")) self.tabWidget.setCurrentWidget(self.tab_alt) layout = QtGui.QVBoxLayout() layout.addWidget(FigureCanvasQTAgg(fig)) self.tab_alt.setLayout(layout)
def _create_main_frame(self, filename): self._main_frame = QtGui.QWidget() self._image = None try: self._image = sphelper.import_spimage(filename) except IOError: print("Must provide a file") exit(1) self._dpi = 100 self._fig = Figure((10.0, 10.0), dpi=self._dpi) self._fig.subplots_adjust(left=0., right=1., bottom=0., top=1.) self._canvas = FigureCanvasQTAgg(self._fig) self._canvas.setParent(self._main_frame) self._axes = self._fig.add_subplot(111) self._axes.set_xticks([]) self._axes.set_yticks([]) self._mpl_toolbar = NavigationToolbar2QT(self._canvas, self._main_frame) self._slider_length = 100 self._angle_slider = QtGui.QSlider(QtCore.Qt.Vertical) self._angle_slider.setMinimum(0) self._angle_slider.setMaximum(self._slider_length) self._angle_slider.setValue(self._angle) self._angle_slider.setTracking(True) self._angle_label = QtGui.QLabel( f"angle = {self._angle/numpy.pi*180.}") self._angle_label.setFixedWidth(100) self._angle_slider.sliderMoved.connect(self._angle_changed) vbox1 = QtGui.QVBoxLayout() vbox1.addWidget(self._canvas) vbox1.addWidget(self._mpl_toolbar) vbox2 = QtGui.QVBoxLayout() vbox2.addWidget(self._angle_label) vbox2.addWidget(self._angle_slider) hbox = QtGui.QHBoxLayout() hbox.addLayout(vbox1) hbox.addLayout(vbox2) self._main_frame.setLayout(hbox) self.setCentralWidget(self._main_frame) self._update_image()
def histogram(self, data): print('test') window = QtGui.QMainWindow(self) window.setAttribute(QtCore.Qt.WA_DeleteOnClose) window.setWindowTitle(self.tr('Histogram')) window.setFixedSize(600, 600) figure = Figure() #Create fig canvas = FigureCanvasQTAgg(figure) canvas.setParent(window) canvas.setGeometry(10, 10, 580, 580) ax = figure.add_subplot(111) ax.hist(data, 100) canvas.draw() window.show()
def bruteplot(self, data): window = QtGui.QMainWindow(self) window.setAttribute(QtCore.Qt.WA_DeleteOnClose) window.setWindowTitle(self.tr('Best Moving Average')) window.setFixedSize(1000, 600) figure = Figure() #Create fig canvas = FigureCanvasQTAgg(figure) canvas.setParent(window) canvas.setGeometry(10, 10, 980, 580) ax = figure.add_subplot(111) ax.plot(data) canvas.draw() window.show()
def plot_speed(self): """ Wrzuca plot do zakladki w gui :return: """ if self.data_loaded: fig = self.visualizer.speed_time(False) self.tab_speed = QtGui.QWidget() self.tab_speed.setObjectName(_fromUtf8("speed")) self.tabWidget.addTab(self.tab_speed, _fromUtf8("Prędkość")) self.tabWidget.setCurrentWidget(self.tab_speed) layout = QtGui.QVBoxLayout() layout.addWidget(FigureCanvasQTAgg(fig)) self.tab_speed.setLayout(layout)
def __init__(self): super(WGrafica, self).__init__() uic.loadUi("grafica.ui", self) fig, ax = plt.subplots() ax.plot([1, 2, 3], [1, 2, 3]) self.ax = ax self.canvas = FigureCanvasQTAgg(fig) self.verticalLayout.addWidget(self.canvas)
def plot_dst_accu(self): """ Wrzuca plot do zakladki w gui :return: """ if self.data_loaded: fig = self.visualizer.dst_accu_time(False) self.tab_dst_accu = QtGui.QWidget() self.tab_dst_accu.setObjectName(_fromUtf8("dst")) self.tabWidget.addTab(self.tab_dst_accu, _fromUtf8("Dystans na jednostkę")) self.tabWidget.setCurrentWidget(self.tab_dst_accu) layout = QtGui.QVBoxLayout() layout.addWidget(FigureCanvasQTAgg(fig)) self.tab_dst_accu.setLayout(layout)
def DrawPlot(self, title, title_x, title_y, valuex, valuey): print 'Creating plot...' Plotter.checkbox_min = self.spinBox_min.value() Plotter.checkbox_max = self.spinBox_max.value() self.tabWidget.removeTab(0) self.newTab = QtGui.QWidget() self.newTab.setObjectName(_fromUtf8("plot")) self.tabWidget.insertTab(0, self.newTab, _fromUtf8("Wykres")) self.tabWidget.setCurrentWidget(self.newTab) layout = QtGui.QVBoxLayout() fig = self.plotHolder.PlotCreator(title, title_x, title_y, valuex, valuey) layout.addWidget(FigureCanvasQTAgg(fig)) self.newTab.setLayout(layout) print 'Plot created.'
def koordinatensystem_hinzufuegen(self): 'Figure-Objekt instanziieren' self.figure = Figure() 'Zeichenfläche instanziieren' self.canvas = FigureCanvasQTAgg(self.figure) 'Koordinatensystem hinzufügen' #in der 1.Zeile und Spalte 1 Koordinatensystem self.axes = self.figure.add_subplot(111) 'Layout Management' layout = QHBoxLayout(self) layout.addWidget(self.canvas)
def model1(self): # aggregation:AggrFnc aggrFnc = AggrFnc([self.wx, 1 - self.wx]) #preferenceCubeFig:Figure preferenceCubeFig = paintPreferenceCube(self.linPrefModelConf, self.title, self.pointsWithIDs, aggrFnc, self.numberOfThresholds) # figureCanvas1:FigureCanvas self.figureCanvas1 = FigureCanvasQTAgg(preferenceCubeFig) self.layout.addWidget(self.figureCanvas1, 0, 1, 2, 4)
def __init__(self, main_window, locs): super().__init__() self.main_window = main_window self.locs = locs self.figure = plt.Figure() self.canvas = FigureCanvasQTAgg(self.figure) self.plot() vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) vbox.addWidget(self.canvas) vbox.addWidget((NavigationToolbar2QT(self.canvas, self))) self.setWindowTitle("Picasso: Filter") this_directory = os.path.dirname(os.path.realpath(__file__)) icon_path = os.path.join(this_directory, "icons", "filter.ico") icon = QtGui.QIcon(icon_path) self.setWindowIcon(icon)
def changePlotWidget(self, library, frame_for_plot): #print("profiletool : changePlotWidget( %s )" % library ) if library == "Qwt5" and has_qwt: plotWdg = QwtPlot(frame_for_plot) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(plotWdg.sizePolicy().hasHeightForWidth()) plotWdg.setSizePolicy(sizePolicy) plotWdg.setMinimumSize(QSize(0,0)) plotWdg.setAutoFillBackground(False) #Decoration plotWdg.setCanvasBackground(Qt.white) plotWdg.plotLayout().setAlignCanvasToScales(True) zoomer = QwtPlotZoomer(QwtPlot.xBottom, QwtPlot.yLeft, QwtPicker.DragSelection, QwtPicker.AlwaysOff, plotWdg.canvas()) zoomer.setRubberBandPen(QPen(Qt.blue)) if platform.system() != "Windows": # disable picker in Windows due to crashes picker = QwtPlotPicker(QwtPlot.xBottom, QwtPlot.yLeft, QwtPicker.NoSelection, QwtPlotPicker.CrossRubberBand, QwtPicker.AlwaysOn, plotWdg.canvas()) picker.setTrackerPen(QPen(Qt.green)) #self.dockwidget.qwtPlot.insertLegend(QwtLegend(), QwtPlot.BottomLegend); grid = Qwt.QwtPlotGrid() grid.setPen(QPen(QColor('grey'), 0, Qt.DotLine)) grid.attach(plotWdg) return plotWdg elif library == "Matplotlib" and has_mpl: from matplotlib.figure import Figure from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg fig = Figure( (1.0, 1.0), linewidth=0.0, subplotpars = matplotlib.figure.SubplotParams(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0) ) font = {'family' : 'arial', 'weight' : 'normal', 'size' : 12} rc('font', **font) rect = fig.patch rect.set_facecolor((0.9,0.9,0.9)) self.subplot = fig.add_axes((0.05, 0.15, 0.92,0.82)) self.subplot.set_xbound(0,1000) self.subplot.set_ybound(0,1000) self.manageMatplotlibAxe(self.subplot) canvas = FigureCanvasQTAgg(fig) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) canvas.setSizePolicy(sizePolicy) return canvas
def __init__(self, fig=Figure()): super().__init__() self.canvas = FigureCanvasQTAgg(fig) self.toolbar = NavigationToolbar2QT(self.canvas, self) # Just some button connected to `plot` method self.button = QtWidgets.QPushButton('Plot Random') self.button.clicked.connect(self.setRandomImage) self.layout = QtWidgets.QVBoxLayout() self.setLayout(self.layout) self.layout.addWidget(self.toolbar) self.layout.addWidget(self.canvas) # self.layout.addWidget(self.button) self.toolbar.setStyleSheet('background: transparent;')
def updateContents(self, inputPorts): """ updateContents(inputPorts: tuple) -> None Update the widget contents based on the input data """ (figInstance, ) = inputPorts if not self.figure or self.figure.number != figInstance.number: if self.layout().count() > 0: self.layout().removeWidget(self.canvas) self.figure = figInstance self.canvas = FigureCanvasQTAgg(self.figure) self.mplToolbar = MplNavigationToolbar(self.canvas, None) self.canvas.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.layout().addWidget(self.canvas)
def __init__(self, detections, cmds, settings, sample_rate, parent=None): qt.QWidget.__init__(self, parent) self.plotters = [ Plotter(detection, settings, sample_rate) for detection in detections ] self.detections = detections self.block_selector = qt.QTabBar() for detection in detections: title = str(detection.result.block) self.block_selector.addTab(title) self.cmds = cmds self.cmd_selector = qt.QTabBar() for cmd in cmds: self.cmd_selector.addTab(cmd) self.block_selector.currentChanged.connect(self.plot) self.cmd_selector.currentChanged.connect(self.plot) self.fig = Figure(frameon=True) self.canvas = FigureCanvasQTAgg(self.fig) self.toolbar = NavigationToolbar2QT(self.canvas, parent) self.canvas.mpl_connect('key_press_event', self.on_key_press) self.canvas.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding) self.canvas.setFocusPolicy(QtCore.Qt.StrongFocus) self.summary_liner = detect.SummaryLineFormatter(sample_rate, settings.block_len, add_dt=False) self.summary_line = qt.QLabel() self.summary_line.setAlignment(QtCore.Qt.AlignHCenter) vbox = qt.QVBoxLayout() vbox.addWidget(qt.QLabel('Detect Analysis')) vbox.addWidget(self.block_selector) vbox.addWidget(self.cmd_selector) vbox.addWidget(self.summary_line) vbox.addWidget(self.canvas) vbox.addWidget(self.toolbar) self.setLayout(vbox) self.plot() self.canvas.setFocus()
def __init__(self, parent, timestamps=None, n_states=10, state_min=0, width=5, height=8, dpi=100, static_data=None, overlay_data=None): super(MPLWidget, self).__init__() self.parent = parent self.timestamps = timestamps self.n_states = n_states self.state_min = state_min self.static_data = static_data self.overlay_data = overlay_data self.fig = Figure((width, height), dpi=dpi) self.ax = self.fig.add_subplot(111) self.canvas = FigureCanvasQTAgg(self.fig) self.canvas.setParent(self) self.canvas.setFocusPolicy(QtCore.Qt.StrongFocus) self.canvas.setFocus() self.toolbar = NavigationToolbar(self.canvas, self) self.zoom_active = False for child in self.toolbar.children(): if isinstance(child, qw.QToolButton) and child.text() == 'Zoom': child.toggled.connect(self.zoom_button_toggled) self.init_figure() self.canvas.mpl_connect('button_press_event', self.button_pressed) self.canvas.mpl_connect('button_release_event', self.button_released) self.canvas.mpl_connect('motion_notify_event', self.mouse_moved) vbox = qw.QVBoxLayout() vbox.addWidget(self.toolbar) vbox.addWidget(self.canvas) self.setLayout(vbox)
def DrawPlot(self): Plotter.dopasowana = self.checkBox_dopasowana.isChecked() Plotter.poczatkowa = self.checkBox_poczatkowa.isChecked() Plotter.dane = self.checkBox_dane.isChecked() Plotter.xlim_min = self.spinbox_zakresOd.value() Plotter.xlim_max = self.spinbox_zakresDo.value() self.tabWidget.removeTab(0) self.newTab = QtGui.QWidget() self.newTab.setObjectName(_fromUtf8("plot")) self.tabWidget.insertTab(0, self.newTab, _fromUtf8("Wykres")) self.tabWidget.setCurrentWidget(self.newTab) layout = QtGui.QVBoxLayout() fig = self.plot.plot(self.gen.returnX(), self.gen.returnY(), self.gen.returnYn(), self.fit.returnFittedData()) layout.addWidget(FigureCanvasQTAgg(fig)) self.newTab.setLayout(layout) print 'Plot created.'
def add_plot(self): #Intialise matplotlib in the UI currency = self.cl.currentText() index = self.cb.currentText() self.figure = Figure() #Create fig self.canvas = FigureCanvasQTAgg(self.figure) self.canvas.setParent(self) self.canvas.setGeometry(11, 150, 1179, 700) self.axis = self.figure.add_subplot(111) self.axis.set_xlabel("") self.axis.legend(loc=2) to_plot = self.all_data[ self.cb.currentText()] #Plotting data is first item in list to_plot = self.reindex(to_plot) #Plot from 100 self.first_date = to_plot.index[ 0] #Set universal variable for currency plotting text = index + " " + currency self.plotter(to_plot, text) #Plot
def updateModel(self): # aggregation:AggrFnc aggrFnc = AggrFnc([self.wx, 1 - self.wx]) # preferenceCubeFig:Figure preferenceCubeFig = paintPreferenceCube(self.linPrefModelConf, self.title, self.pointsWithIDs, aggrFnc, self.numberOfThresholds) # figureCanvas1New:FigureCanvas figureCanvas1New = FigureCanvasQTAgg(preferenceCubeFig) # removing old figure self.figureCanvas1.deleteLater() self.layout.replaceWidget(self.figureCanvas1, figureCanvas1New) self.figureCanvas1 = figureCanvas1New
def __init__(self, pymol, protein_map, parent=None): super(ContactMapWidget, self).__init__(parent) self.dpi = 300 self.pymol = pymol self.protein_map = protein_map self.parent = parent self.gridpsec = gridspec.GridSpec(1, 1) self.figure = Figure((8, 8), dpi=self.dpi) self.canvas = FigureCanvasQTAgg(self.figure) self.axes = self.figure.add_subplot(self.gridpsec[0]) self.layoutVertical = QtGui.QVBoxLayout(self) self.layoutVertical.setStretchFactor(self.canvas, 1) self.layoutVertical.addWidget(self.canvas) self.selection_count = 0 self._ispressed = False self.rect = None self.glob_ss_rects = [] self.glob_charged_dots = [] self.glob_hydrophobic_dots = [] self.glob_bfactor_dots = []
def __init__(self, parent=None): super(MatplotlibWidget, self).__init__(parent) self.figure = Figure() self.canvas = FigureCanvasQTAgg(self.figure) #: Initialize Plots self.axis1 = self.figure.add_subplot(211) self.axis2 = self.figure.add_subplot(212) self.axis1.set_autoscaley_on(False) #: Disable Auto scale self.axis1.set_xlim([0, 2000]) self.axis1.set_ylim([-1.5, 1.5]) self.axis2.set_autoscaley_on(False) self.axis2.set_xlim([1, 60]) self.axis2.set_ylim([0, 65000]) self.axis1.set_xticks(np.arange(0, 2000, 100)) self.axis1.set_yticks(np.arange(-1.5, 1.5, 0.3)) self.axis1.grid(False) #: Useless. True doesnt work either. #: Non dynamic parts are cached so that we can decrease the draw time self.background = self.canvas.copy_from_bbox(self.axis1.bbox) self.layoutVertical = QtGui.QVBoxLayout(self) self.layoutVertical.addWidget(self.canvas)
def plot_acceleration(self): """ Wrzuca plot do zakladki w gui :return: """ if self.data_loaded: #funkcja klasy visualizer zwraca nam pyplot.figure ( czyli przyklad) fig = self.visualizer.acceleration_time(False) #tworzymy zaklwadke w przegladarce wykresow ktora jest instancja QTabWidget self.tab_acc = QtGui.QWidget() #nadajemy zakladce nazwe self.tab_acc.setObjectName(_fromUtf8("acc")) #dodajemy zakladke do przegladarki nazywajac ja Przyspieszenie self.tabWidget.addTab(self.tab_acc, _fromUtf8("Przyspieszenie")) #ustawiamy focus na nowa zakladke self.tabWidget.setCurrentWidget(self.tab_acc) #tworzymy layout strony layout = QtGui.QVBoxLayout() #przypisujemy wykres z przykladu jako layout layout.addWidget(FigureCanvasQTAgg(fig)) #dodajemy layout do zakladki self.tab_acc.setLayout(layout)
def __init__(self, parent=None): super(MatplotlibWidget, self).__init__(parent) self.figure = Figure() self.canvas = FigureCanvasQTAgg(self.figure) self.axis = self.figure.add_subplot(111) self.layoutVertical = QtGui.QVBoxLayout(self) self.layoutVertical.addWidget(self.canvas) # set the limit for the x and y xAchse = pylab.arange(0, len_val, 1) yAchse = pylab.array([0] * len_val) self.axis.set_xlim(0., len_val + 50) self.axis.set_ylim(-1.5, 10) self.axis.grid(True) self.axis.set_title("Realtime Frequency Plot") self.axis.set_xlabel("Time") self.axis.set_ylabel("Frequency") #self.axis([0,100,-1.5,1.5]) self.axis.plot(xAchse, yAchse, '-')