本文整理汇总了Python中matplotlib.backends.backend_qt5agg.NavigationToolbar2QT方法的典型用法代码示例。如果您正苦于以下问题:Python backend_qt5agg.NavigationToolbar2QT方法的具体用法?Python backend_qt5agg.NavigationToolbar2QT怎么用?Python backend_qt5agg.NavigationToolbar2QT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt5agg
的用法示例。
在下文中一共展示了backend_qt5agg.NavigationToolbar2QT方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot_3D
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
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)
#
示例2: __init__
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
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)
示例3: __init__
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
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)
示例4: tabbed_qt4_window
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
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_()
示例5: tabbed_qt5_window
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
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_()
示例6: embedCollectionsBuilder
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
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
示例7: __init__
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
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)
示例8: __init__
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
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)
示例9: figure_widget
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
def figure_widget(fig, parent=None):
widget = FigureCanvas(fig)
if parent != None:
widget.setParent(parent)
toolbar = NavigationToolbar(widget, widget)
return widget
示例10: __init__
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
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)
示例11: __init__
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
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)
示例12: __init__
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
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)
示例13: attach
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
def attach(self, gui):
self.gui = gui
self.nav = NavigationToolbar(self.canvas, gui, coordinates=False)
self.nav.pan()
示例14: show
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
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
示例15: __init__
# 需要导入模块: from matplotlib.backends import backend_qt5agg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
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)