本文整理汇总了Python中silx.gui.plot.PlotWidget.setGraphYLabel方法的典型用法代码示例。如果您正苦于以下问题:Python PlotWidget.setGraphYLabel方法的具体用法?Python PlotWidget.setGraphYLabel怎么用?Python PlotWidget.setGraphYLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类silx.gui.plot.PlotWidget
的用法示例。
在下文中一共展示了PlotWidget.setGraphYLabel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestSaveActionSaveCurvesAsSpec
# 需要导入模块: from silx.gui.plot import PlotWidget [as 别名]
# 或者: from silx.gui.plot.PlotWidget import setGraphYLabel [as 别名]
class TestSaveActionSaveCurvesAsSpec(unittest.TestCase):
def setUp(self):
self.plot = PlotWidget(backend='none')
self.saveAction = SaveAction(plot=self.plot)
self.tempdir = tempfile.mkdtemp()
self.out_fname = os.path.join(self.tempdir, "out.dat")
def tearDown(self):
os.unlink(self.out_fname)
os.rmdir(self.tempdir)
def testSaveMultipleCurvesAsSpec(self):
"""Test that labels are properly used."""
self.plot.setGraphXLabel("graph x label")
self.plot.setGraphYLabel("graph y label")
self.plot.addCurve([0, 1], [1, 2], "curve with labels",
xlabel="curve0 X", ylabel="curve0 Y")
self.plot.addCurve([-1, 3], [-6, 2], "curve with X label",
xlabel="curve1 X")
self.plot.addCurve([-2, 0], [8, 12], "curve with Y label",
ylabel="curve2 Y")
self.plot.addCurve([3, 1], [7, 6], "curve with no labels")
self.saveAction._saveCurves(self.plot,
self.out_fname,
SaveAction.DEFAULT_ALL_CURVES_FILTERS[0]) # "All curves as SpecFile (*.dat)"
with open(self.out_fname, "rb") as f:
file_content = f.read()
if hasattr(file_content, "decode"):
file_content = file_content.decode()
# case with all curve labels specified
self.assertIn("#S 1 curve0 Y", file_content)
self.assertIn("#L curve0 X curve0 Y", file_content)
# graph X&Y labels are used when no curve label is specified
self.assertIn("#S 2 graph y label", file_content)
self.assertIn("#L curve1 X graph y label", file_content)
self.assertIn("#S 3 curve2 Y", file_content)
self.assertIn("#L graph x label curve2 Y", file_content)
self.assertIn("#S 4 graph y label", file_content)
self.assertIn("#L graph x label graph y label", file_content)
示例2: RGBCorrelatorGraph
# 需要导入模块: from silx.gui.plot import PlotWidget [as 别名]
# 或者: from silx.gui.plot.PlotWidget import setGraphYLabel [as 别名]
class RGBCorrelatorGraph(qt.QWidget):
sigProfileSignal = qt.pyqtSignal(object)
def __init__(self, parent = None, backend=None, selection=False, aspect=True,
colormap=False,
imageicons=False, standalonesave=True, standalonezoom=True,
profileselection=False, polygon=False):
qt.QWidget.__init__(self, parent)
self.mainLayout = qt.QVBoxLayout(self)
self.mainLayout.setContentsMargins(0, 0, 0, 0)
self.mainLayout.setSpacing(0)
self._keepDataAspectRatioFlag = False
self.graph = PlotWidget(parent=self, backend=backend)
self.graph.setGraphXLabel("Column")
self.graph.setGraphYLabel("Row")
self.graph.setYAxisAutoScale(True)
self.graph.setXAxisAutoScale(True)
plotArea = self.graph.getWidgetHandle()
plotArea.setContextMenuPolicy(qt.Qt.CustomContextMenu)
plotArea.customContextMenuRequested.connect(self._zoomBack)
self._buildToolBar(selection, colormap, imageicons,
standalonesave,
standalonezoom=standalonezoom,
profileselection=profileselection,
aspect=aspect,
polygon=polygon)
if profileselection:
if len(self._pickerSelectionButtons):
self.graph.sigPlotSignal.connect(\
self._graphPolygonSignalReceived)
self._pickerSelectionWidthValue.valueChanged[int].connect( \
self.setPickerSelectionWith)
self.saveDirectory = os.getcwd()
self.mainLayout.addWidget(self.graph)
def sizeHint(self):
return qt.QSize(1.5 * qt.QWidget.sizeHint(self).width(),
qt.QWidget.sizeHint(self).height())
def _buildToolBar(self, selection=False, colormap=False,
imageicons=False, standalonesave=True,
standalonezoom=True, profileselection=False,
aspect=False, polygon=False):
self.solidCircleIcon = qt.QIcon(qt.QPixmap(IconDict["solidcircle"]))
self.solidEllipseIcon = qt.QIcon(qt.QPixmap(IconDict["solidellipse"]))
self.colormapIcon = qt.QIcon(qt.QPixmap(IconDict["colormap"]))
self.selectionIcon = qt.QIcon(qt.QPixmap(IconDict["normal"]))
self.zoomResetIcon = qt.QIcon(qt.QPixmap(IconDict["zoomreset"]))
self.polygonIcon = qt.QIcon(qt.QPixmap(IconDict["polygon"]))
self.printIcon = qt.QIcon(qt.QPixmap(IconDict["fileprint"]))
self.saveIcon = qt.QIcon(qt.QPixmap(IconDict["filesave"]))
self.xAutoIcon = qt.QIcon(qt.QPixmap(IconDict["xauto"]))
self.yAutoIcon = qt.QIcon(qt.QPixmap(IconDict["yauto"]))
self.hFlipIcon = qt.QIcon(qt.QPixmap(IconDict["gioconda16mirror"]))
self.imageIcon = qt.QIcon(qt.QPixmap(IconDict["image"]))
self.eraseSelectionIcon = qt.QIcon(qt.QPixmap(IconDict["eraseselect"]))
self.rectSelectionIcon = qt.QIcon(qt.QPixmap(IconDict["boxselect"]))
self.brushSelectionIcon = qt.QIcon(qt.QPixmap(IconDict["brushselect"]))
self.brushIcon = qt.QIcon(qt.QPixmap(IconDict["brush"]))
self.additionalIcon = qt.QIcon(qt.QPixmap(IconDict["additionalselect"]))
self.hLineIcon = qt.QIcon(qt.QPixmap(IconDict["horizontal"]))
self.vLineIcon = qt.QIcon(qt.QPixmap(IconDict["vertical"]))
self.lineIcon = qt.QIcon(qt.QPixmap(IconDict["diagonal"]))
self.copyIcon = silx_icons.getQIcon("edit-copy")
self.toolBar = qt.QWidget(self)
self.toolBarLayout = qt.QHBoxLayout(self.toolBar)
self.toolBarLayout.setContentsMargins(0, 0, 0, 0)
self.toolBarLayout.setSpacing(0)
self.mainLayout.addWidget(self.toolBar)
#Autoscale
if standalonezoom:
tb = self._addToolButton(self.zoomResetIcon,
self.__zoomReset,
'Auto-Scale the Graph')
else:
tb = self._addToolButton(self.zoomResetIcon,
None,
'Auto-Scale the Graph')
self.zoomResetToolButton = tb
#y Autoscale
tb = self._addToolButton(self.yAutoIcon,
self._yAutoScaleToggle,
'Toggle Autoscale Y Axis (On/Off)',
toggle = True, state=True)
tb.setDown(True)
self.yAutoScaleToolButton = tb
tb.setDown(True)
#x Autoscale
tb = self._addToolButton(self.xAutoIcon,
self._xAutoScaleToggle,
'Toggle Autoscale X Axis (On/Off)',
toggle = True, state=True)
self.xAutoScaleToolButton = tb
tb.setDown(True)
#.........这里部分代码省略.........