本文整理匯總了Python中silx.gui.plot.PlotWindow.setLimits方法的典型用法代碼示例。如果您正苦於以下問題:Python PlotWindow.setLimits方法的具體用法?Python PlotWindow.setLimits怎麽用?Python PlotWindow.setLimits使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類silx.gui.plot.PlotWindow
的用法示例。
在下文中一共展示了PlotWindow.setLimits方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestPlotWindow
# 需要導入模塊: from silx.gui.plot import PlotWindow [as 別名]
# 或者: from silx.gui.plot.PlotWindow import setLimits [as 別名]
class TestPlotWindow(TestCaseQt):
"""Base class for tests of PlotWindow."""
def setUp(self):
super(TestPlotWindow, self).setUp()
self.plot = PlotWindow()
self.plot.show()
self.qWaitForWindowExposed(self.plot)
def tearDown(self):
self.plot.setAttribute(qt.Qt.WA_DeleteOnClose)
self.plot.close()
del self.plot
super(TestPlotWindow, self).tearDown()
def testActions(self):
"""Test the actions QToolButtons"""
self.plot.setLimits(1, 100, 1, 100)
checkList = [ # QAction, Plot state getter
(self.plot.xAxisAutoScaleAction, self.plot.getXAxis().isAutoScale),
(self.plot.yAxisAutoScaleAction, self.plot.getYAxis().isAutoScale),
(self.plot.xAxisLogarithmicAction, self.plot.getXAxis()._isLogarithmic),
(self.plot.yAxisLogarithmicAction, self.plot.getYAxis()._isLogarithmic),
(self.plot.gridAction, self.plot.getGraphGrid),
]
for action, getter in checkList:
self.mouseMove(self.plot)
initialState = getter()
toolButton = getQToolButtonFromAction(action)
self.assertIsNot(toolButton, None)
self.mouseClick(toolButton, qt.Qt.LeftButton)
self.assertNotEqual(getter(), initialState,
msg='"%s" state not changed' % action.text())
self.mouseClick(toolButton, qt.Qt.LeftButton)
self.assertEqual(getter(), initialState,
msg='"%s" state not changed' % action.text())
# Trigger a zoom reset
self.mouseMove(self.plot)
resetZoomAction = self.plot.resetZoomAction
toolButton = getQToolButtonFromAction(resetZoomAction)
self.assertIsNot(toolButton, None)
self.mouseClick(toolButton, qt.Qt.LeftButton)
def testToolAspectRatio(self):
self.plot.toolBar()
self.plot.keepDataAspectRatioButton.keepDataAspectRatio()
self.assertTrue(self.plot.isKeepDataAspectRatio())
self.plot.keepDataAspectRatioButton.dontKeepDataAspectRatio()
self.assertFalse(self.plot.isKeepDataAspectRatio())
def testToolYAxisOrigin(self):
self.plot.toolBar()
self.plot.yAxisInvertedButton.setYAxisUpward()
self.assertFalse(self.plot.getYAxis().isInverted())
self.plot.yAxisInvertedButton.setYAxisDownward()
self.assertTrue(self.plot.getYAxis().isInverted())