本文整理汇总了Python中matplotlib.backends.backend_qt4agg.NavigationToolbar2QT.show方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QT.show方法的具体用法?Python NavigationToolbar2QT.show怎么用?Python NavigationToolbar2QT.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4agg.NavigationToolbar2QT
的用法示例。
在下文中一共展示了NavigationToolbar2QT.show方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mGraph
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import show [as 别名]
#.........这里部分代码省略.........
self.twoWkButton.hide()
self.allButton.hide()
self.matframe.hide()
self.matPlotInfo.hide()
self.toolbarFrame.hide()
layout = QtGui.QVBoxLayout()
layout.addLayout(buttonLayout)
layout.addLayout(buttonLayout2)
layout.addLayout(buttonLayout3)
layout.addWidget(self.matPlotInfo)
layout.addWidget(self.matframe)
layout.addWidget(self.toolbarFrame)
self.setLayout(layout)
def enableAutoScaling(self):
self.timer.start(self.refreshRateSec * 1000)
# self.canvas.mpl_disconnect(self.cid)
# self.cid = self.canvas.mpl_connect('button_press_event', self.disableAutoScaling)
self.home = True
self.matPlotInfo.hide()
# self.deviceThread = threading.Thread(target =
# self.plot, args=[self.currTimeRange])
# If the main thread stops, stop the child thread
# self.deviceThread.daemon = True
# Start the thread
# self.deviceThread.start()
self.plot(self.currTimeRange)
def disableAutoScaling(self, event):
self.home = False
self.matPlotInfo.show()
self.canvas.update()
# plt.show()
# print event.name
# self.canvas.mpl_disconnect(self.cid)
# self.cid = self.canvas.mpl_connect('button_press_event', self.enableAutoScaling)
self.timer.stop()
# self.zoom(self.toolbar)
def togglePlot(self):
if not self.hidden:
self.canvas.hide()
self.toolbar.hide()
self.thrtysecButton.hide()
self.twoMinButton.hide()
self.fiveMinButton.hide()
self.thrtyMinButton.hide()
self.twoHrButton.hide()
self.tenHrButton.hide()
self.oneDayButton.hide()
self.oneWkButton.hide()
self.twoWkButton.hide()
self.allButton.hide()
self.matPlotInfo.hide()
self.matframe.hide()
self.toolbarFrame.hide()
self.timer.stop()
self.hideButton.setText("Show Plot")
self.hidden = True
elif self.hidden:
self.canvas.show()
示例2: MplGraphWidget
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import show [as 别名]
#.........这里部分代码省略.........
def on_mouse_move(self, event):
self.mouse_move.emit(event)
key_press_handler(event, self.canvas, self.mpl_toolbar)
def get_icon(name):
"""Return Matplotlib icon *name*"""
return QtGui.QIcon(osp.join(rcParams['datapath'], 'images', name))
def generateNewAxes(self):
for ax in self.all_sp_axes:
self.fig.delaxes(ax)
self.all_sp_axes = []
numOfAxes = (self._spRows*self._spCols)+1
for i in np.arange(1,numOfAxes):
self.all_sp_axes.append(self.fig.add_subplot(self._spRows, self._spCols, i))
self.canvas.setGeometry(100, 100, 300, 300) #Used to update the new number of axes
self.canvas.updateGeometry() #This will bring the size of the canvas back to the original (defined by the vbox)
spRowsChanged = QtCore.pyqtSignal(int)
def getspRows(self):
return self._spRows
@QtCore.pyqtSlot(int)
def setspRows(self, spRows):
self._spRows = spRows
self.generateNewAxes()
self.spRowsChanged.emit(spRows)
def resetspRows(self):
self.setspRows(1)
spRows = QtCore.pyqtProperty(int, getspRows, setspRows, resetspRows)
spColsChanged = QtCore.pyqtSignal(int)
def getspCols(self):
return self._spCols
@QtCore.pyqtSlot(int)
def setspCols(self, spCols):
self._spCols = spCols
self.generateNewAxes()
self.spRowsChanged.emit(spCols)
def resetspCols(self):
self.setspCols(1)
spCols = QtCore.pyqtProperty(int, getspCols, setspCols, resetspCols)
dataChanged = QtCore.pyqtSignal(bool)
def get_Y_data(self):
return self._dataY
@QtCore.pyqtSlot(int)
def set_Y_data(self, y_data):
self._dataY = y_data
self.dataChanged.emit(True)
def plot(self, on_axes=0):
if np.size(self._dataX) == 0:
self.all_sp_axes[on_axes].plot(self._dataY)
else:
self.all_sp_axes[on_axes].plot(self._dataX, self._dataY)
def getNavBarOn(self):
return self._navBarOn
def setNavBarOn(self, navBarOn):
self._navBarOn = navBarOn
if not navBarOn:
self.mpl_toolbar.hide()
else:
self.mpl_toolbar.show()
def resetNavBarOn(self):
self._navBarOn = True
navBarOn = QtCore.pyqtProperty(bool, getNavBarOn, setNavBarOn, resetNavBarOn)
# def getautoscale(self):
# return self._autoscale
#
# def setautoscale(self, autoscale):
# self._autoscale = autoscale
# for axis in self.all_sp_axes:
# axis.set_autoscale(autoscale)
#
# def resetautoscale(self):
# self._autoscale = False
#
# autoscale = QtCore.pyqtProperty(bool, getautoscale, setautoscale, resetautoscale)
@QtCore.pyqtSlot(bool)
def set_autoscale(self, autoscale):
for axis in self.all_sp_axes:
axis.set_autoscale(autoscale)
示例3: Window
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import show [as 别名]
class Window(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.shot = None #opened shot
self.folder_name = '' #folder to search for shots
self.current_num = 0 #current diagram
self.currently_selected = None #selected point plot
self.selected_points = OrderedSet() #point to be added
self.current_point = None #plot of current point
self.overall_selected = None #points added to selected list
#super(Window, self).__init__(parent)
# a figure instance to plot on
self.figure = plt.figure()
# this is the Canvas Widget that displays the `figure`
# it takes the `figure` instance as a parameter to __init__
self.canvas = FigureCanvas(self.figure)
self.canvas.setParent(parent)
self.canvas.setFocusPolicy(QtCore.Qt.StrongFocus)
self.canvas.setFocus()
self.canvas.setMinimumSize(500, 0)
self.canvas.mpl_connect('pick_event', self.on_pick)
self.canvas.mpl_connect('motion_notify_event', self.on_move)
self.canvas.hide()
# this is the Navigation widget
# it takes the Canvas widget and a pa rent
self.toolbar = NavigationToolbar(self.canvas, self)
self.toolbar.hide()
# Show files widget
self.files = QtGui.QListWidget()
self.files.itemDoubleClicked.connect(self.select_file)
self.files.setMaximumSize(200, 100000)
self.files.setMinimumSize(100, 0)
self.files.hide()
# Show selected points
self.points = ThumbListWidget(self)
#self.points.itemDoubleClicked.connect(self.unselect_point)
self.points.itemClicked.connect(self.points_clicked)
self.points.itemDoubleClicked.connect(self.points_doubleclicked)
self.points.setMaximumSize(200, 100000)
self.points.setMinimumSize(100, 0)
self.points.hide()
#Show diagram widget
self.diagrams = QtGui.QListWidget()
self.diagrams.itemClicked.connect(self.select_item)
self.diagrams.setMaximumSize(250, 100000)
self.diagrams.setMinimumSize(190, 0)
self.diagrams.hide()
#save result button
self.save_button = QtGui.QPushButton('Add time point', self)
self.save_button.clicked.connect(self.add_time)
self.save_button.hide()
#filter menu
self.filters_button = QtGui.QPushButton('Manage filters', self)
self.filters_button.clicked.connect(self.show_filters)
self.filters_button.hide()
self.filters = OrderedDict
self.read_filters()
#diagramms
self.bottom_layout = QtGui.QGridLayout()
self.diagrams_figure = plt.figure()
self.diagrams_canvas = FigureCanvas(self.diagrams_figure)
self.diagrams_canvas.setParent(parent)
self.diagrams_canvas.setMinimumSize(250, 250)
self.diagrams_canvas.setMaximumSize(500, 500)
self.diagrams_toolbar = NavigationToolbar(self.diagrams_canvas, self)
self.diagrams_toolbar.setMaximumWidth(250)
self.diagrams_ax = self.diagrams_figure.add_subplot(111)
self.diagrams_ax.set_ylim(ymin=0)
self.diagrams_ax.set_xlim(xmin=0)
self.diagrams_canvas.draw()
self.enlargre_button = QtGui.QPushButton('Enlarge diagram', self)
self.enlargre_button.clicked.connect(self.enlarge_diagram)
self.bottom_layout.addWidget(self.diagrams_toolbar, 0, 2)
self.bottom_layout.addWidget(self.diagrams_canvas, 1, 2, QtCore.Qt.AlignRight)
self.bottom_layout.addWidget(self.enlargre_button, 0, 1)
# set the layout
self.layout = QtGui.QGridLayout()
self.layout.addWidget(self.filters_button, 0, 1)
self.layout.addWidget(self.toolbar, 0, 2)
self.layout.addWidget(self.canvas, 1, 2)
self.layout.addWidget(self.diagrams, 1, 1)
self.layout.addWidget(self.files, 1, 0)
self.layout.addWidget(self.points, 1, 3)
self.layout.addWidget(self.save_button, 0, 3)
self.layout.addLayout(self.bottom_layout, 2, 2)
self.setLayout(self.layout)
#.........这里部分代码省略.........