本文整理汇总了Python中silx.gui.plot.PlotWindow.setGraphXLabel方法的典型用法代码示例。如果您正苦于以下问题:Python PlotWindow.setGraphXLabel方法的具体用法?Python PlotWindow.setGraphXLabel怎么用?Python PlotWindow.setGraphXLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类silx.gui.plot.PlotWindow
的用法示例。
在下文中一共展示了PlotWindow.setGraphXLabel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QXTube
# 需要导入模块: from silx.gui.plot import PlotWindow [as 别名]
# 或者: from silx.gui.plot.PlotWindow import setGraphXLabel [as 别名]
class QXTube(qt.QWidget):
sigQXTubeSignal = qt.pyqtSignal(object)
def __init__(self, parent=None, initdict = None):
qt.QWidget.__init__(self, parent)
self.l = qt.QVBoxLayout(self)
self.l.setContentsMargins(0, 0, 0, 0)
self.l.setSpacing(0)
self.tubeWidget = TubeWidget(self, initdict = initdict)
self.setParameters = self.tubeWidget.setParameters
self.getParameters = self.tubeWidget.getParameters
label = qt.QLabel(self)
hbox = qt.QWidget(self)
hboxl = qt.QHBoxLayout(hbox)
hboxl.setContentsMargins(0, 0, 0, 0)
hboxl.setSpacing(0)
self.plotButton = qt.QPushButton(hbox)
self.plotButton.setText("Plot Continuum")
self.exportButton = qt.QPushButton(hbox)
self.exportButton.setText("Export to Fit")
#grid.addWidget(self.plotButton, 7, 1)
#grid.addWidget(self.exportButton, 7, 3)
hboxl.addWidget(self.plotButton)
hboxl.addWidget(self.exportButton)
self.l.addWidget(self.tubeWidget)
f = label.font()
f.setItalic(1)
label.setFont(f)
label.setAlignment(qt.Qt.AlignRight)
label.setText("H. Ebel, X-Ray Spectrometry 28 (1999) 255-266 ")
self.l.addWidget(label)
self.l.addWidget(hbox)
self.graph = PlotWindow(self, colormap=False, yInverted=False,
aspectRatio=False, control=False,
position=False, roi=False, mask=False,
fit=False)
self.pluginsToolButton = PluginsToolButton(plot=self.graph)
self.graph.toolBar().addWidget(self.pluginsToolButton)
self.graph.getInteractiveModeToolBar().getZoomModeAction().setVisible(False)
self.graph.getInteractiveModeToolBar().getPanModeAction().setVisible(False)
self.l.addWidget(self.graph)
self.graph.setGraphXLabel("Energy (keV)")
self.graph.setGraphYLabel("photons/sr/mA/keV/s")
self.plotButton.clicked.connect(self.plot)
self.exportButton.clicked.connect(self._export)
def plot(self):
d = self.tubeWidget.getParameters()
transmission = d["transmission"]
anode = d["anode"]
anodedensity = d["anodedensity"]
anodethickness = d["anodethickness"]
voltage = d["voltage"]
wele = d["window"]
wdensity = d["windowdensity"]
wthickness = d["windowthickness"]
fele = d["filter1"]
fdensity = d["filter1density"]
fthickness = d["filter1thickness"]
filterlist =[[fele, fdensity, fthickness]]
alphae = d["alphae"]
alphax = d["alphax"]
delta = d["deltaplotting"]
e = numpy.arange(1, voltage, delta)
if __name__ == "__main__":
continuumR = XRayTubeEbel.continuumEbel([anode, anodedensity, anodethickness],
voltage, e,
[wele, wdensity, wthickness],
alphae=alphae, alphax=alphax,
transmission=0,
targetthickness=anodethickness,
filterlist=filterlist)
continuumT = XRayTubeEbel.continuumEbel([anode, anodedensity, anodethickness],
voltage, e,
[wele, wdensity, wthickness],
alphae=alphae, alphax=alphax,
transmission=1,
targetthickness=anodethickness,
filterlist=filterlist)
self.graph.addCurve(e, continuumR, "continuumR")
self.graph.addCurve(e, continuumT, "continuumT")
else:
continuum = XRayTubeEbel.continuumEbel([anode, anodedensity, anodethickness],
voltage, e,
#.........这里部分代码省略.........
示例2: PlotWindow
# 需要导入模块: from silx.gui.plot import PlotWindow [as 别名]
# 或者: from silx.gui.plot.PlotWindow import setGraphXLabel [as 别名]
plotwin = PlotWindow(control=True)
toolbar = qt.QToolBar("My toolbar")
plotwin.addToolBar(toolbar)
myaction = FftAction(plotwin)
toolbar.addAction(myaction)
# x range: 0 -- 10 (1000 points)
x = numpy.arange(1000) * 0.01
twopi = 2 * numpy.pi
# Sum of sine functions with frequencies 3, 20 and 42 Hz
y1 = numpy.sin(twopi * 3 * x) + 1.5 * numpy.sin(twopi * 20 * x) + 2 * numpy.sin(twopi * 42 * x)
# Cosine with frequency 7 Hz and phase pi / 3
y2 = numpy.cos(twopi * 7 * (x - numpy.pi / 3))
# 5 periods of square wave, amplitude 2
y3 = numpy.zeros_like(x)
for i in [0, 2, 4, 6, 8]:
y3[i * len(x) / 10 : (i + 1) * len(x) / 10] = 2
plotwin.addCurve(x, y1, legend="sin")
plotwin.addCurve(x, y2, legend="cos")
plotwin.addCurve(x, y3, legend="square wave")
plotwin.setGraphTitle("Original data")
plotwin.setGraphYLabel("amplitude")
plotwin.setGraphXLabel("time")
plotwin.show()
app.exec_()