Python matplotlib.backends.backend_qt5agg.NavigationToolbar2QT() Examples
The following are 30
code examples of matplotlib.backends.backend_qt5agg.NavigationToolbar2QT().
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: demo_label.py From openpose-pytorch with GNU Lesser General Public License v3.0 | 6 votes |
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 #2
Source File: pandapower_gui.py From pandapower_gui with BSD 3-Clause "New" or "Revised" License | 6 votes |
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 #3
Source File: plot.py From pychemqt with GNU General Public License v3.0 | 6 votes |
def plot_3D(self, labels, xdata, ydata, zdata, config=None): """Método que dibuja la matriz de datos""" self.ax.clear() self.data={"x": xdata[0], "y": ydata[:,0], "z": zdata} if config and config.getboolean("MEOS", "surface"): self.ax.plot_surface(xdata, ydata, zdata, rstride=1, cstride=1) else: self.ax.plot_wireframe(xdata, ydata, zdata, rstride=1, cstride=1) self.ax.set_xlabel(labels[0]) self.ax.set_ylabel(labels[1]) self.ax.set_zlabel(labels[2]) self.ax.mouse_init(rotate_btn=1, zoom_btn=2) #class PlotWidget(QtGui.QWidget): # def __init__(self, dim, parent=None): # super(PlotWidget, self).__init__(parent) # layout=QtGui.QVBoxLayout(self) # self.plot=matplotlib(dim) # layout.addWidget(self.plot) # # self.toolbar=NavigationToolbar2QT(self, self) # layout.addWidget(self.toolbar) #
Example #4
Source File: plot.py From evo_slam with GNU General Public License v3.0 | 6 votes |
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 #5
Source File: abstract_main_window.py From peakonly with MIT License | 6 votes |
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 #6
Source File: plot.py From evo with GNU General Public License v3.0 | 6 votes |
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 #7
Source File: nanotron.py From picasso with MIT License | 6 votes |
def __init__(self, window_title): super().__init__() self.setWindowTitle(window_title) this_directory = os.path.dirname(os.path.realpath(__file__)) icon_path = os.path.join(this_directory, "icons", "nanotron.ico") icon = QtGui.QIcon(icon_path) self.setWindowIcon(icon) self.resize(1000, 500) self.figure = plt.Figure() self.canvas = FigureCanvas(self.figure) vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) vbox.addWidget(self.canvas) self.toolbar = NavigationToolbar(self.canvas, self) vbox.addWidget(self.toolbar)
Example #8
Source File: plot.py From evo with GNU General Public License v3.0 | 6 votes |
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 #9
Source File: plot.py From evo_slam with GNU General Public License v3.0 | 6 votes |
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 #10
Source File: mplwidget.py From pySPM with Apache License 2.0 | 5 votes |
def __init__(self, parent = None): QWidget.__init__(self, parent) self.canvas = MplCanvas() self.mpl_toolbar = NavigationToolbar(self.canvas, self) layout = QVBoxLayout() self.setLayout(layout) layout.addWidget(self.mpl_toolbar) layout.addWidget(self.canvas)
Example #11
Source File: plot.py From phy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def show(self): self.canvas.draw() if not self.gui and not self._shown: self.nav = NavigationToolbar(self.canvas, None, coordinates=False) self.nav.pan() self._shown = True
Example #12
Source File: stability.py From pySPM with Apache License 2.0 | 5 votes |
def __init__(self): QWidget.__init__(self) self.cwd = None self.figure = Figure() self.canvas = FigureCanvas(self.figure) self.toolbar = NavigationToolbar(self.canvas, self) self.markers = None self.draggable = None self.img = None self.msize = 6 openAction = QAction('&Open', self) openAction.setShortcut('Ctrl+O') openAction.setStatusTip('Open folder') openAction.triggered.connect(self.open) menubar = self.menuBar() fileMenu = menubar.addMenu('&File') fileMenu.addAction(openAction) self.fileDrop = QComboBox() layout = QVBoxLayout() layout.addWidget(self.fileDrop) layout.addWidget(self.toolbar) layout.addWidget(self.canvas) window = QWidget() window.setLayout(layout); self.setCentralWidget(window) self.fileDrop.currentIndexChanged.connect(self.plot) self.show()
Example #13
Source File: MatplotlibWidget.py From qgisSpaceSyntaxToolkit with GNU General Public License v3.0 | 5 votes |
def __init__(self, size=(5.0, 4.0), dpi=100): QtGui.QWidget.__init__(self) self.fig = Figure(size, dpi=dpi) self.canvas = FigureCanvas(self.fig) self.canvas.setParent(self) self.toolbar = NavigationToolbar(self.canvas, self) self.vbox = QtGui.QVBoxLayout() self.vbox.addWidget(self.toolbar) self.vbox.addWidget(self.canvas) self.setLayout(self.vbox)
Example #14
Source File: matplotlibwidget.py From GridCal with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): QWidget.__init__(self, parent) self.frame = QWidget() self.canvas = MplCanvas() self.canvas.setParent(self.frame) self.mpltoolbar = Navigationtoolbar(self.canvas, self.frame) self.vbl = QVBoxLayout() self.vbl.addWidget(self.canvas) self.vbl.addWidget(self.mpltoolbar) self.setLayout(self.vbl) self.mpltoolbar.toggleViewAction()
Example #15
Source File: matplotlibwidget.py From GridCal with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): QWidget.__init__(self, parent) self.frame = QWidget() self.canvas = MplCanvas() self.canvas.setParent(self.frame) self.mpltoolbar = Navigationtoolbar(self.canvas, self.frame) self.vbl = QVBoxLayout() self.vbl.addWidget(self.canvas) self.vbl.addWidget(self.mpltoolbar) self.setLayout(self.vbl) self.mpltoolbar.toggleViewAction()
Example #16
Source File: matplotlibwidget.py From GridCal with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): QWidget.__init__(self, parent) self.frame = QWidget() self.canvas = MplCanvas() self.canvas.setParent(self.frame) self.mpltoolbar = Navigationtoolbar(self.canvas, self.frame) self.vbl = QVBoxLayout() self.vbl.addWidget(self.canvas) self.vbl.addWidget(self.mpltoolbar) self.setLayout(self.vbl) self.mpltoolbar.toggleViewAction()
Example #17
Source File: matplotlibwidget.py From GridCal with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): QWidget.__init__(self, parent) self.frame = QWidget() self.canvas = MplCanvas() self.canvas.setParent(self.frame) self.mpltoolbar = Navigationtoolbar(self.canvas, self.frame) self.vbl = QVBoxLayout() self.vbl.addWidget(self.canvas) self.vbl.addWidget(self.mpltoolbar) self.setLayout(self.vbl) self.mpltoolbar.toggleViewAction()
Example #18
Source File: matplotlibwidget.py From GridCal with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): QWidget.__init__(self, parent) self.frame = QWidget() self.canvas = MplCanvas() self.canvas.setParent(self.frame) self.mpltoolbar = Navigationtoolbar(self.canvas, self.frame) self.vbl = QVBoxLayout() self.vbl.addWidget(self.canvas) self.vbl.addWidget(self.mpltoolbar) self.setLayout(self.vbl) self.mpltoolbar.toggleViewAction()
Example #19
Source File: matplotlibwidget.py From GridCal with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): QWidget.__init__(self, parent) self.frame = QWidget() self.canvas = MplCanvas() self.canvas.setParent(self.frame) self.mpltoolbar = Navigationtoolbar(self.canvas, self.frame) self.vbl = QVBoxLayout() self.vbl.addWidget(self.canvas) self.vbl.addWidget(self.mpltoolbar) self.setLayout(self.vbl) self.mpltoolbar.toggleViewAction()
Example #20
Source File: mplwidget.py From pySPM with Apache License 2.0 | 5 votes |
def __init__(self, parent = None): QWidget.__init__(self, parent) self.canvas = MplCanvas() self.mpl_toolbar = NavigationToolbar(self.canvas,self) layout = QVBoxLayout() self.setLayout(layout) layout.addWidget(self.mpl_toolbar) layout.addWidget(self.canvas)
Example #21
Source File: MatplotlibWidget.py From soapy with GNU General Public License v3.0 | 5 votes |
def __init__(self, size=(5.0, 4.0), dpi=100): QtGui.QWidget.__init__(self) self.fig = Figure(size, dpi=dpi) self.canvas = FigureCanvas(self.fig) self.canvas.setParent(self) self.toolbar = NavigationToolbar(self.canvas, self) self.vbox = QtGui.QVBoxLayout() self.vbox.addWidget(self.toolbar) self.vbox.addWidget(self.canvas) self.setLayout(self.vbox)
Example #22
Source File: MatplotlibWidget.py From tf-pose with Apache License 2.0 | 5 votes |
def __init__(self, size=(5.0, 4.0), dpi=100): QtGui.QWidget.__init__(self) self.fig = Figure(size, dpi=dpi) self.canvas = FigureCanvas(self.fig) self.canvas.setParent(self) self.toolbar = NavigationToolbar(self.canvas, self) self.vbox = QtGui.QVBoxLayout() self.vbox.addWidget(self.toolbar) self.vbox.addWidget(self.canvas) self.setLayout(self.vbox)
Example #23
Source File: plot.py From phy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def attach(self, gui): self.gui = gui self.nav = NavigationToolbar(self.canvas, gui, coordinates=False) self.nav.pan()
Example #24
Source File: RadarUI.py From pycwr with MIT License | 5 votes |
def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) # Inherit from QWidget self.canvas = MplCanvas() # Create canvas object self.ntb = NavigationToolbar(self.canvas, parent) self.vbl = QtWidgets.QVBoxLayout() # Set box for plotting self.vbl.addWidget(self.canvas) self.vbl.addWidget(self.ntb) self.setLayout(self.vbl)
Example #25
Source File: plot.py From pychemqt with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): super(Plot, self).__init__(parent) gridLayout = QtWidgets.QGridLayout(self) self.plot=matplotlib() gridLayout.addWidget(self.plot,1,1,1,2) self.toolbar=NavigationToolbar2QT(self.plot, self.plot) gridLayout.addWidget(self.toolbar,2,1) self.buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Close) self.buttonBox.setSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) self.buttonBox.rejected.connect(self.reject) gridLayout.addWidget(self.buttonBox,2,2)
Example #26
Source File: MatplotlibWidget.py From FAE with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None, size=(5.0, 4.0), dpi=100): QtGui.QWidget.__init__(self) super(MatplotlibWidget, self).__init__(parent) self.fig = Figure(size, dpi=dpi) self.canvas = FigureCanvas(self.fig) self.canvas.setParent(self) # self.toolbar = NavigationToolbar(self.canvas, self) self.vbox = QtGui.QVBoxLayout() # self.vbox.addWidget(self.toolbar) self.vbox.addWidget(self.canvas) self.setLayout(self.vbox)
Example #27
Source File: vis_mpl.py From calfem-python with MIT License | 5 votes |
def figure_widget(fig, parent=None): widget = FigureCanvas(fig) if parent != None: widget.setParent(parent) toolbar = NavigationToolbar(widget, widget) return widget
Example #28
Source File: IDAtropy.py From IDAtropy with GNU General Public License v3.0 | 4 votes |
def make_histogram(self): self.counter = histogram(self.data) self.counts = [round(100*float(byte_count)/self.data_size, 2) for byte_count in self.counter] top_y = math.ceil(max(self.counts)*10.0)/10.0 del self.data self.create_table() fig = plt.figure(facecolor='white') ax = plt.subplot(111, facecolor='white') control_bytes = 0 whitespace_bytes = 0 null_bytes = self.counter[0] printable_bytes = sum([self.counter[byte] for byte in range(0x21, 0x7F)]) high_bytes = sum([self.counter[byte] for byte in range(0x80, 0x100)]) for byte in range(1, 0x21): if chr(byte) in string.whitespace: whitespace_bytes += self.counter[byte] else: control_bytes += self.counter[byte] log("Histogram - Data size: %d bytes" % self.data_size) self.log_byte_stats("NULL bytes", null_bytes) self.log_byte_stats("Control bytes", control_bytes) self.log_byte_stats("Whitespace bytes", whitespace_bytes) self.log_byte_stats("Printable bytes", printable_bytes) self.log_byte_stats("High bytes", high_bytes) plt.axis([0, 256, 0, top_y]) ax.set_xlim(0, 255) ax.set_xticks([0, 64, 128, 192, 255]) ax.format_coord = self.format_coord bar_colors = ['#2040D0','#2E9AFE'] ax.bar(range(256), self.counts, width=1, edgecolor="black", linewidth=0.4, color=bar_colors*128) plt.title("Byte histogram") plt.xlabel('Byte range') plt.ylabel('Occurance [%]') self.canvas = FigureCanvas(fig) self.toolbar = NavigationToolbar(self.canvas, self) grid = QtWidgets.QGridLayout() grid.addWidget(self.canvas, 0, 0) grid.addWidget(self.toolbar, 1, 0) grid.addWidget(self.table, 0, 1, 0, 2) self.setLayout(grid)
Example #29
Source File: IDAtropy.py From IDAtropy with GNU General Public License v3.0 | 4 votes |
def make_normal_chart(self): blocks = self.data_size / self.entropy_cfg['block_size'] self.calc_addr_fcn = self.calc_point_addr_normal results = list(entropy_scan(self.data, self.entropy_cfg['block_size'], self.entropy_cfg['step_size']) ) min_value, max_value = min(results), max(results) avg_values = sum(results) / len(results) self.fig = plt.figure(facecolor='white') ax = plt.subplot(111, facecolor='white') ax.axis([0, len(results), 0, 8]) ax.format_coord = self.format_coord_normal plt.plot(results, color="#2E9AFE") log("Entropy - Start address: 0x%08x" % self.config.start_addr) log("Entropy - End address: 0x%08x" % self.config.end_addr) log("Entropy - Data size: %d bytes (blocks: %d)" % (self.data_size, blocks)) info_str = 'Entropy - Min: %.2f | Max: %.2f | Avg: %.2f' % (min_value, max_value, avg_values) log(info_str) del self.data plt.xlabel('Byte range') plt.ylabel('Entropy') plt.title('Entropy levels') self.canvas = FigureCanvas(self.fig) self.toolbar = NavigationToolbar(self.canvas, self) self.line_edit = QtWidgets.QLineEdit() self.cb_jump_on_click = QtWidgets.QCheckBox("Disable double-click event") self.cb_jump_on_click.stateChanged.connect(self.disable_jump_on_click) grid = QtWidgets.QGridLayout() grid.addWidget(self.canvas, 0, 0) grid.addWidget(self.toolbar, 1, 0) if not self.config.use_disk_binary or self.entropy_cfg['segm_exists']: grid.addWidget(self.cb_jump_on_click, 2, 0) self.cid = self.fig.canvas.mpl_connect('button_press_event', self.on_click) self.setLayout(grid)
Example #30
Source File: training.py From peakonly with MIT License | 4 votes |
def _init_ui(self): # canvas layout (with 3 subplots) self.figure = plt.figure() self.loss_ax = self.figure.add_subplot(131) self.loss_ax.set_title('Loss function') self.classification_score_ax = self.figure.add_subplot(132) self.classification_score_ax.set_title('Classification score') self.segmentation_score_ax = self.figure.add_subplot(133) self.segmentation_score_ax.set_title('Segmentation score') self.canvas = FigureCanvas(self.figure) toolbar = NavigationToolbar(self.canvas, self) canvas_layout = QtWidgets.QVBoxLayout() canvas_layout.addWidget(toolbar) canvas_layout.addWidget(self.canvas) self.figure.tight_layout() # training parameters layout parameters_layout = QtWidgets.QVBoxLayout() empty_label = QtWidgets.QLabel() number_of_epochs_label = QtWidgets.QLabel() number_of_epochs_label.setText('Number of epochs:') self.number_of_epochs_getter = QtWidgets.QLineEdit(self) self.number_of_epochs_getter.setText('100') learning_rate_label = QtWidgets.QLabel() learning_rate_label.setText('Learning rate:') self.learning_rate_getter = QtWidgets.QLineEdit(self) self.learning_rate_getter.setText('1e-3') parameters_layout.addWidget(empty_label, 80) parameters_layout.addWidget(number_of_epochs_label, 5) parameters_layout.addWidget(self.number_of_epochs_getter, 5) parameters_layout.addWidget(learning_rate_label, 5) parameters_layout.addWidget(self.learning_rate_getter, 5) # buttons layout buttons_layout = QtWidgets.QHBoxLayout() restart_button = QtWidgets.QPushButton('Restart') restart_button.clicked.connect(self.restart) buttons_layout.addWidget(restart_button) save_weights_button = QtWidgets.QPushButton('Save weights') save_weights_button.clicked.connect(self.save_weights) buttons_layout.addWidget(save_weights_button) run_training_button = QtWidgets.QPushButton('Run training') run_training_button.clicked.connect(self.run_training) buttons_layout.addWidget(run_training_button) # main layouts upper_layout = QtWidgets.QHBoxLayout() upper_layout.addLayout(canvas_layout, 85) upper_layout.addLayout(parameters_layout, 15) main_layout = QtWidgets.QVBoxLayout() main_layout.addLayout(upper_layout) main_layout.addLayout(buttons_layout) self.setLayout(main_layout)