diff options
Diffstat (limited to 'examples/plotLimits.py')
-rw-r--r-- | examples/plotLimits.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/examples/plotLimits.py b/examples/plotLimits.py index 0a39bc6..01d67c7 100644 --- a/examples/plotLimits.py +++ b/examples/plotLimits.py @@ -1,8 +1,7 @@ #!/usr/bin/env python -# coding: utf-8 # /*########################################################################## # -# Copyright (c) 2016-2017 European Synchrotron Radiation Facility +# Copyright (c) 2016-2021 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -23,8 +22,8 @@ # THE SOFTWARE. # # ###########################################################################*/ -"""This script is an example to illustrate how to use axis synchronization -tool. +"""This script is an example to illustrate how to set range constraints on +plot axes. """ from silx.gui import qt @@ -34,10 +33,9 @@ import silx.test.utils class ConstrainedViewPlot(qt.QMainWindow): - def __init__(self): qt.QMainWindow.__init__(self) - self.setWindowTitle("Plot with synchronized axes") + self.setWindowTitle("Plot with constrained axes") widget = qt.QWidget(self) self.setCentralWidget(widget) @@ -56,14 +54,14 @@ class ConstrainedViewPlot(qt.QMainWindow): self.plot2d = plot.Plot2D(parent=widget, backend=backend) self.plot2d.setGraphTitle("A pixel can't be too big") - self.plot2d.setInteractiveMode('pan') + self.plot2d.setInteractiveMode("pan") self.plot2d.addImage(data) self.plot2d.getXAxis().setRangeConstraints(minRange=10) self.plot2d.getYAxis().setRangeConstraints(minRange=10) self.plot2d2 = plot.Plot2D(parent=widget, backend=backend) self.plot2d2.setGraphTitle("The image can't be too small") - self.plot2d2.setInteractiveMode('pan') + self.plot2d2.setInteractiveMode("pan") self.plot2d2.addImage(data) self.plot2d2.getXAxis().setRangeConstraints(maxRange=200) self.plot2d2.getYAxis().setRangeConstraints(maxRange=200) @@ -72,13 +70,17 @@ class ConstrainedViewPlot(qt.QMainWindow): self.plot1d.setGraphTitle("The curve is clamped into the view") self.plot1d.addCurve(x=numpy.arange(100), y=data1d, legend="mean") self.plot1d.getXAxis().setLimitsConstraints(minPos=0, maxPos=100) - self.plot1d.getYAxis().setLimitsConstraints(minPos=data1d.min(), maxPos=data1d.max()) + self.plot1d.getYAxis().setLimitsConstraints( + minPos=data1d.min(), maxPos=data1d.max() + ) self.plot1d2 = plot.Plot1D(parent=widget, backend=backend) self.plot1d2.setGraphTitle("Only clamp y-axis") - self.plot1d2.setInteractiveMode('pan') + self.plot1d2.setInteractiveMode("pan") self.plot1d2.addCurve(x=numpy.arange(100), y=data1d, legend="mean") - self.plot1d2.getYAxis().setLimitsConstraints(minPos=data1d.min(), maxPos=data1d.max()) + self.plot1d2.getYAxis().setLimitsConstraints( + minPos=data1d.min(), maxPos=data1d.max() + ) layout.addWidget(self.plot2d, 0, 0) layout.addWidget(self.plot1d, 0, 1) @@ -90,4 +92,4 @@ if __name__ == "__main__": app = qt.QApplication([]) window = ConstrainedViewPlot() window.setVisible(True) - app.exec_() + app.exec() |