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