本文整理汇总了Python中silx.gui.plot.PlotWidget类的典型用法代码示例。如果您正苦于以下问题:Python PlotWidget类的具体用法?Python PlotWidget怎么用?Python PlotWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PlotWidget类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, *var, **kw):
PlotWidget.__init__(self, *var, **kw)
# No context menu by default, execute zoomBack on right click
if "backend" in kw:
setBackend = kw["backend"]
else:
setBackend = None
_logger.info("SilxBackend called with backend = %s" % setBackend)
plotArea = self.getWidgetHandle()
plotArea.setContextMenuPolicy(qt.Qt.CustomContextMenu)
plotArea.customContextMenuRequested.connect(self._zoomBack)
开发者ID:vasole,项目名称:pymca,代码行数:11,代码来源:SilxBackend.py
示例2: __init__
def __init__(self, parent=None):
super(MaskScatterWidget, self).__init__(parent=parent)
self._activeScatterLegend = "active scatter"
self._bgImageLegend = "background image"
# widgets
centralWidget = qt.QWidget(self)
self._plot = PlotWidget(parent=centralWidget)
self._maskToolsWidget = ScatterMaskToolsWidget.ScatterMaskToolsWidget(
plot=self._plot, parent=centralWidget)
self._alphaSlider = NamedScatterAlphaSlider(parent=self, plot=self._plot)
self._alphaSlider.setOrientation(qt.Qt.Horizontal)
self._alphaSlider.setToolTip("Adjust scatter opacity")
# layout
layout = qt.QVBoxLayout(centralWidget)
layout.addWidget(self._plot)
layout.addWidget(self._alphaSlider)
layout.addWidget(self._maskToolsWidget)
centralWidget.setLayout(layout)
self.setCentralWidget(centralWidget)
开发者ID:dnaudet,项目名称:silx,代码行数:25,代码来源:scatterMask.py
示例3: __init__
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)
开发者ID:maurov,项目名称:pymca,代码行数:34,代码来源:SilxRGBCorrelatorGraph.py
示例4: addCurve
def addCurve(self, *var, **kw):
if "replot" in kw:
if kw["replot"]:
kw["resetzoom"] = True
del kw["replot"]
result = PlotWidget.addCurve(self, *var, **kw)
allCurves = self.getAllCurves(just_legend=True)
if len(allCurves) == 1:
self.setActiveCurve(allCurves[0])
return result
开发者ID:vasole,项目名称:pymca,代码行数:10,代码来源:SilxBackend.py
示例5: __init__
def __init__(self, parent=None):
qt.QWidget.__init__(self, parent)
self.setWindowTitle("Strip and SNIP Configuration Window")
self.mainLayout = qt.QVBoxLayout(self)
self.mainLayout.setContentsMargins(0, 0, 0, 0)
self.mainLayout.setSpacing(2)
self.parametersWidget = BackgroundParamWidget(self)
self.graphWidget = PlotWidget(parent=self)
self.mainLayout.addWidget(self.parametersWidget)
self.mainLayout.addWidget(self.graphWidget)
self._x = None
self._y = None
self.parametersWidget.sigBackgroundParamWidgetSignal.connect(self._slot)
开发者ID:dnaudet,项目名称:silx,代码行数:13,代码来源:BackgroundWidget.py
示例6: setUp
def setUp(self):
super(TestNamedImageAlphaSlider, self).setUp()
self.plot = PlotWidget()
self.aslider = AlphaSlider.NamedImageAlphaSlider(plot=self.plot)
self.aslider.setOrientation(qt.Qt.Horizontal)
toolbar = qt.QToolBar("plot", self.plot)
toolbar.addWidget(self.aslider)
self.plot.addToolBar(toolbar)
self.plot.show()
self.qWaitForWindowExposed(self.plot)
self.mouseMove(self.plot) # Move to center
self.qapp.processEvents()
开发者ID:vallsv,项目名称:silx,代码行数:15,代码来源:testAlphaSlider.py
示例7: addImage
def addImage(self, *var, **kw):
if "replot" in kw:
del kw["replot"]
if "xScale" in kw:
xScale = kw["xScale"]
del kw["xScale"]
if "yScale" in kw:
yScale = kw["yScale"]
del kw["yScale"]
if xScale is not None or yScale is not None:
origin = kw.get("origin", None)
scale = kw.get("scale", None)
if origin is None and scale is None:
kw["origin"] = xScale[0], yScale[0]
kw["scale"] = xScale[1], yScale[1]
return PlotWidget.addImage(self, *var, **kw)
开发者ID:vasole,项目名称:pymca,代码行数:16,代码来源:SilxBackend.py
示例8: _PlotWidgetTest
class _PlotWidgetTest(TestCaseQt):
"""Base class for tests of PlotWidget, not a TestCase in itself.
plot attribute is the PlotWidget created for the test.
"""
def setUp(self):
super(_PlotWidgetTest, self).setUp()
self.plot = PlotWidget()
self.plot.show()
self.qWaitForWindowExposed(self.plot)
def tearDown(self):
self.qapp.processEvents()
self.plot.setAttribute(qt.Qt.WA_DeleteOnClose)
self.plot.close()
del self.plot
super(_PlotWidgetTest, self).tearDown()
开发者ID:CaptainNemoz,项目名称:silx,代码行数:18,代码来源:testPlotWidget.py
示例9: setUp
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")
开发者ID:vallsv,项目名称:silx,代码行数:6,代码来源:testSaveAction.py
示例10: setUp
def setUp(self):
self.plot = PlotWidget()
开发者ID:dnaudet,项目名称:silx,代码行数:2,代码来源:testLimitConstraints.py
示例11: TestSaveActionSaveCurvesAsSpec
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)
开发者ID:vallsv,项目名称:silx,代码行数:48,代码来源:testSaveAction.py
示例12: __init__
def __init__(self, parent=None):
qt.QMainWindow.__init__(self, parent=parent)
if parent is not None:
# behave as a widget
self.setWindowFlags(qt.Qt.Widget)
else:
self.setWindowTitle("PyMca - Image Selection Tool")
centralWidget = qt.QWidget(self)
layout = qt.QVBoxLayout(centralWidget)
centralWidget.setLayout(layout)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
# Plot
self.plot = PlotWidget(parent=centralWidget)
self.plot.setWindowFlags(qt.Qt.Widget)
self.plot.setDefaultColormap({'name': 'temperature',
'normalization': 'linear',
'autoscale': True,
'vmin': 0.,
'vmax': 1.})
layout.addWidget(self.plot)
# Mask Widget
self._maskToolsDockWidget = None
# Image selection slider
self.slider = qt.QSlider(self.centralWidget())
self.slider.setOrientation(qt.Qt.Horizontal)
self.slider.setMinimum(0)
self.slider.setMaximum(0)
layout.addWidget(self.slider)
self.slider.valueChanged[int].connect(self.showImage)
# ADD/REMOVE/REPLACE IMAGE buttons
buttonBox = qt.QWidget(self)
buttonBoxLayout = qt.QHBoxLayout(buttonBox)
buttonBoxLayout.setContentsMargins(0, 0, 0, 0)
buttonBoxLayout.setSpacing(0)
self.addImageButton = qt.QPushButton(buttonBox)
icon = qt.QIcon(qt.QPixmap(IconDict["rgb16"]))
self.addImageButton.setIcon(icon)
self.addImageButton.setText("ADD IMAGE")
self.addImageButton.setToolTip("Add image to RGB correlator")
buttonBoxLayout.addWidget(self.addImageButton)
self.removeImageButton = qt.QPushButton(buttonBox)
self.removeImageButton.setIcon(icon)
self.removeImageButton.setText("REMOVE IMAGE")
self.removeImageButton.setToolTip("Remove image from RGB correlator")
buttonBoxLayout.addWidget(self.removeImageButton)
self.replaceImageButton = qt.QPushButton(buttonBox)
self.replaceImageButton.setIcon(icon)
self.replaceImageButton.setText("REPLACE IMAGE")
self.replaceImageButton.setToolTip(
"Replace all images in RGB correlator with this one")
buttonBoxLayout.addWidget(self.replaceImageButton)
self.addImageButton.clicked.connect(self._addImageClicked)
self.removeImageButton.clicked.connect(self._removeImageClicked)
self.replaceImageButton.clicked.connect(self._replaceImageClicked)
layout.addWidget(buttonBox)
# median filter widget
self._medianParameters = {'row_width': 1,
'column_width': 1,
'conditional': 0}
self._medianParametersWidget = MedianParameters(self,
use_conditional=True)
self._medianParametersWidget.widthSpin.setValue(1)
self._medianParametersWidget.widthSpin.valueChanged[int].connect(
self._setMedianKernelWidth)
self._medianParametersWidget.conditionalSpin.valueChanged[int].connect(
self._setMedianConditionalFlag)
layout.addWidget(self._medianParametersWidget)
# motor positions (hidden by default)
self.motorPositionsWidget = MotorInfoWindow.MotorInfoDialog(self,
[""],
[{}])
self.motorPositionsWidget.setMaximumHeight(100)
self.plot.sigPlotSignal.connect(self._updateMotors)
self.motorPositionsWidget.hide()
self._motors_first_update = True
layout.addWidget(self.motorPositionsWidget)
self.setCentralWidget(centralWidget)
# Init actions
self.group = qt.QActionGroup(self)
self.group.setExclusive(False)
self.resetZoomAction = self.group.addAction(
PlotActions.ResetZoomAction(plot=self.plot, parent=self))
self.addAction(self.resetZoomAction)
#.........这里部分代码省略.........
开发者ID:maurov,项目名称:pymca,代码行数:101,代码来源:SilxMaskImageWidget.py
示例13: TestLimitConstaints
class TestLimitConstaints(unittest.TestCase):
"""Tests setLimitConstaints class"""
def setUp(self):
self.plot = PlotWidget()
def tearDown(self):
self.plot = None
def testApi(self):
"""Test availability of the API"""
self.plot.getXAxis().setLimitsConstraints(minPos=1, maxPos=10)
self.plot.getXAxis().setRangeConstraints(minRange=1, maxRange=1)
self.plot.getYAxis().setLimitsConstraints(minPos=1, maxPos=10)
self.plot.getYAxis().setRangeConstraints(minRange=1, maxRange=1)
def testXMinMax(self):
"""Test limit constains on x-axis"""
self.plot.getXAxis().setLimitsConstraints(minPos=0, maxPos=100)
self.plot.setLimits(xmin=-1, xmax=101, ymin=-1, ymax=101)
self.assertEqual(self.plot.getXAxis().getLimits(), (0, 100))
self.assertEqual(self.plot.getYAxis().getLimits(), (-1, 101))
def testYMinMax(self):
"""Test limit constains on y-axis"""
self.plot.getYAxis().setLimitsConstraints(minPos=0, maxPos=100)
self.plot.setLimits(xmin=-1, xmax=101, ymin=-1, ymax=101)
self.assertEqual(self.plot.getXAxis().getLimits(), (-1, 101))
self.assertEqual(self.plot.getYAxis().getLimits(), (0, 100))
def testMinXRange(self):
"""Test min range constains on x-axis"""
self.plot.getXAxis().setRangeConstraints(minRange=100)
self.plot.setLimits(xmin=1, xmax=99, ymin=1, ymax=99)
limits = self.plot.getXAxis().getLimits()
self.assertEqual(limits[1] - limits[0], 100)
limits = self.plot.getYAxis().getLimits()
self.assertNotEqual(limits[1] - limits[0], 100)
def testMaxXRange(self):
"""Test max range constains on x-axis"""
self.plot.getXAxis().setRangeConstraints(maxRange=100)
self.plot.setLimits(xmin=-1, xmax=101, ymin=-1, ymax=101)
limits = self.plot.getXAxis().getLimits()
self.assertEqual(limits[1] - limits[0], 100)
limits = self.plot.getYAxis().getLimits()
self.assertNotEqual(limits[1] - limits[0], 100)
def testMinYRange(self):
"""Test min range constains on y-axis"""
self.plot.getYAxis().setRangeConstraints(minRange=100)
self.plot.setLimits(xmin=1, xmax=99, ymin=1, ymax=99)
limits = self.plot.getXAxis().getLimits()
self.assertNotEqual(limits[1] - limits[0], 100)
limits = self.plot.getYAxis().getLimits()
self.assertEqual(limits[1] - limits[0], 100)
def testMaxYRange(self):
"""Test max range constains on y-axis"""
self.plot.getYAxis().setRangeConstraints(maxRange=100)
self.plot.setLimits(xmin=-1, xmax=101, ymin=-1, ymax=101)
limits = self.plot.getXAxis().getLimits()
self.assertNotEqual(limits[1] - limits[0], 100)
limits = self.plot.getYAxis().getLimits()
self.assertEqual(limits[1] - limits[0], 100)
def testChangeOfConstraints(self):
"""Test changing of the constraints"""
self.plot.getXAxis().setRangeConstraints(minRange=10, maxRange=10)
# There is no more constraints on the range
self.plot.getXAxis().setRangeConstraints(minRange=None, maxRange=None)
self.plot.setLimits(xmin=-1, xmax=101, ymin=-1, ymax=101)
self.assertEqual(self.plot.getXAxis().getLimits(), (-1, 101))
def testSettingConstraints(self):
"""Test setting a constaint (setLimits first then the constaint)"""
self.plot.setLimits(xmin=-1, xmax=101, ymin=-1, ymax=101)
self.plot.getXAxis().setLimitsConstraints(minPos=0, maxPos=100)
self.assertEqual(self.plot.getXAxis().getLimits(), (0, 100))
开发者ID:dnaudet,项目名称:silx,代码行数:79,代码来源:testLimitConstraints.py
示例14: setActiveCurve
def setActiveCurve(self, legend, replot=True):
return PlotWidget.setActiveCurve(self, legend)
开发者ID:vasole,项目名称:pymca,代码行数:2,代码来源:SilxBackend.py
示例15: SilxMaskImageWidget
class SilxMaskImageWidget(qt.QMainWindow):
"""Main window with a plot widget, a toolbar and a slider.
A list of images can be set with :meth:`setImages`.
The mask can be accessed through getter and setter methods:
:meth:`setSelectionMask` and :meth:`getSelectionMask`.
The plot widget can be accessed as :attr:`plot`. It is a silx
plot widget.
The toolbar offers some basic interaction tools:
zoom control, colormap, aspect ratio, y axis orientation,
"save image" menu and a mask widget.
"""
sigMaskImageWidget = qt.pyqtSignal(object)
def __init__(self, parent=None):
qt.QMainWindow.__init__(self, parent=parent)
if parent is not None:
# behave as a widget
self.setWindowFlags(qt.Qt.Widget)
else:
self.setWindowTitle("PyMca - Image Selection Tool")
centralWidget = qt.QWidget(self)
layout = qt.QVBoxLayout(centralWidget)
centralWidget.setLayout(layout)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
# Plot
self.plot = PlotWidget(parent=centralWidget)
self.plot.setWindowFlags(qt.Qt.Widget)
self.plot.setDefaultColormap({'name': 'temperature',
'normalization': 'linear',
'autoscale': True,
'vmin': 0.,
'vmax': 1.})
layout.addWidget(self.plot)
# Mask Widget
self._maskToolsDockWidget = None
# Image selection slider
self.slider = qt.QSlider(self.centralWidget())
self.slider.setOrientation(qt.Qt.Horizontal)
self.slider.setMinimum(0)
self.slider.setMaximum(0)
layout.addWidget(self.slider)
self.slider.valueChanged[int].connect(self.showImage)
# ADD/REMOVE/REPLACE IMAGE buttons
buttonBox = qt.QWidget(self)
buttonBoxLayout = qt.QHBoxLayout(buttonBox)
buttonBoxLayout.setContentsMargins(0, 0, 0, 0)
buttonBoxLayout.setSpacing(0)
self.addImageButton = qt.QPushButton(buttonBox)
icon = qt.QIcon(qt.QPixmap(IconDict["rgb16"]))
self.addImageButton.setIcon(icon)
self.addImageButton.setText("ADD IMAGE")
self.addImageButton.setToolTip("Add image to RGB correlator")
buttonBoxLayout.addWidget(self.addImageButton)
self.removeImageButton = qt.QPushButton(buttonBox)
self.removeImageButton.setIcon(icon)
self.removeImageButton.setText("REMOVE IMAGE")
self.removeImageButton.setToolTip("Remove image from RGB correlator")
buttonBoxLayout.addWidget(self.removeImageButton)
self.replaceImageButton = qt.QPushButton(buttonBox)
self.replaceImageButton.setIcon(icon)
self.replaceImageButton.setText("REPLACE IMAGE")
self.replaceImageButton.setToolTip(
"Replace all images in RGB correlator with this one")
buttonBoxLayout.addWidget(self.replaceImageButton)
self.addImageButton.clicked.connect(self._addImageClicked)
self.removeImageButton.clicked.connect(self._removeImageClicked)
self.replaceImageButton.clicked.connect(self._replaceImageClicked)
layout.addWidget(buttonBox)
# median filter widget
self._medianParameters = {'row_width': 1,
'column_width': 1,
'conditional': 0}
self._medianParametersWidget = MedianParameters(self,
use_conditional=True)
self._medianParametersWidget.widthSpin.setValue(1)
self._medianParametersWidget.widthSpin.valueChanged[int].connect(
self._setMedianKernelWidth)
self._medianParametersWidget.conditionalSpin.valueChanged[int].connect(
self._setMedianConditionalFlag)
layout.addWidget(self._medianParametersWidget)
# motor positions (hidden by default)
self.motorPositionsWidget = MotorInfoWindow.MotorInfoDialog(self,
[""],
[{}])
#.........这里部分代码省略.........
开发者ID:maurov,项目名称:pymca,代码行数:101,代码来源:SilxMaskImageWidget.py
示例16: setActiveImage
def setActiveImage(self, *var, **kw):
if "replot" in kw:
del kw["replot"]
return PlotWidget.setActiveImage(self, *var, **kw)
开发者ID:vasole,项目名称:pymca,代码行数:4,代码来源:SilxBackend.py
示例17: TestNamedImageAlphaSlider
class TestNamedImageAlphaSlider(TestCaseQt):
def setUp(self):
super(TestNamedImageAlphaSlider, self).setUp()
self.plot = PlotWidget()
self.aslider = AlphaSlider.NamedImageAlphaSlider(plot=self.plot)
self.aslider.setOrientation(qt.Qt.Horizontal)
toolbar = qt.QToolBar("plot", self.plot)
toolbar.addWidget(self.aslider)
self.plot.addToolBar(toolbar)
self.plot.show()
self.qWaitForWindowExposed(self.plot)
self.mouseMove(self.plot) # Move to center
self.qapp.processEvents()
def tearDown(self):
self.qapp.processEvents()
self.plot.setAttribute(qt.Qt.WA_DeleteOnClose)
self.plot.close()
del self.plot
del self.aslider
super(TestNamedImageAlphaSlider, self).tearDown()
def testWidgetEnabled(self):
# no image set initially, slider must be deactivate
self.assertFalse(self.aslider.isEnabled())
self.plot.addImage(numpy.array([[0, 1, 2], [3, 4, 5]]), legend="1")
self.aslider.setLegend("1")
# now we have an image set
self.assertTrue(self.aslider.isEnabled())
def testGetImage(self):
self.plot.addImage(numpy.array([[0, 1, 2], [3, 4, 5]]), legend="1")
self.plot.addImage(numpy.array([[0, 1, 3], [2, 4, 6]]), legend="2")
self.aslider.setLegend("1")
self.assertEqual(self.plot.getImage("1"),
self.aslider.getItem())
self.aslider.setLegend("2")
self.assertEqual(self.plot.getImage("2"),
self.aslider.getItem())
def testGetAlpha(self):
self.plot.addImage(numpy.array([[0, 1, 2], [3, 4, 5]]), legend="1")
self.aslider.setLegend("1")
self.aslider.setValue(128)
self.assertAlmostEqual(self.aslider.getAlpha(),
128. / 255)
开发者ID:vallsv,项目名称:silx,代码行数:52,代码来源:testAlphaSlider.py
示例18: setUp
def setUp(self):
super(_PlotWidgetTest, self).setUp()
self.plot = PlotWidget()
self.plot.show()
self.qWaitForWindowExposed(self.plot)
开发者ID:CaptainNemoz,项目名称:silx,代码行数:5,代码来源:testPlotWidget.py
示例19: ColormapDialog
#.........这里部分代码省略.........
self.minText = MyQLineEdit(hbox2)
self.minText.setFixedWidth(150)
self.minText.setAlignment(qt.Qt.AlignRight)
self.minText.returnPressed[()].connect(self.minTextChanged)
hlayout2.addWidget(self.minText)
# hlayout 3 : - min label
# - min text
hbox3 = qt.QWidget(vboxlimits)
self.__hbox3 = hbox3
hlayout3 = qt.QHBoxLayout(hbox3)
hlayout3.setContentsMargins(0, 0, 0, 0)
hlayout3.setSpacing(0)
#vlayout.addWidget(hbox3)
vboxlimitslayout.addWidget(hbox3)
hlayout3.addStretch(10)
self.maxLabel = qt.QLabel(hbox3)
self.maxLabel.setText("Maximum")
hlayout3.addWidget(self.maxLabel)
hlayout3.addSpacing(5)
hlayout3.addStretch(1)
self.maxText = MyQLineEdit(hbox3)
self.maxText.setFixedWidth(150)
self.maxText.setAlignment(qt.Qt.AlignRight)
self.maxText.returnPressed[()].connect(self.maxTextChanged)
hlayout3.addWidget(self.maxText)
# Graph widget for color curve...
self.c = PlotWidget(self, backend=None)
self.c.setGraphXLabel("Data Values")
self.c.setInteractiveMode('select')
self.marge = (abs(self.dataMax) + abs(self.dataMin)) / 6.0
self.minmd = self.dataMin - self.marge
self.maxpd = self.dataMax + self.marge
self.c.setGraphXLimits(self.minmd, self.maxpd)
self.c.setGraphYLimits(-11.5, 11.5)
x = [self.minmd, self.dataMin, self.dataMax, self.maxpd]
y = [-10, -10, 10, 10 ]
self.c.addCurve(x, y,
legend="ConstrainedCurve",
color='black',
symbol='o',
linestyle='-')
self.markers = []
self.__x = x
self.__y = y
labelList = ["","Min", "Max", ""]
for i in range(4):
if i in [1, 2]:
draggable = True
color = "blue"
else:
draggable = False
color = "black"
#TODO symbol
legend = "%d" % i
self.c.addXMarker(x[i],
legend=legend,
开发者ID:maurov,项目名称:pymca,代码行数:67,代码来源:ColormapDialog.py
示例20: createWidget
def createWidget(self, parent):
plot = PlotWidget(parent)
plot.setAutoReplot(False)
return plot
开发者ID:CaptainNemoz,项目名称:silx,代码行数:4,代码来源:plotwidgetplugin.py
注:本文中的silx.gui.plot.PlotWidget类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论