diff options
author | Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr> | 2018-07-31 16:22:25 +0200 |
---|---|---|
committer | Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr> | 2018-07-31 16:22:25 +0200 |
commit | 159ef14fb9e198bb0066ea14e6b980f065de63dd (patch) | |
tree | bc37c7d4ba09ee59deb708897fa0571709aec293 /examples/plotTimeSeries.py | |
parent | 270d5ddc31c26b62379e3caa9044dd75ccc71847 (diff) |
New upstream version 0.8.0+dfsg
Diffstat (limited to 'examples/plotTimeSeries.py')
-rw-r--r-- | examples/plotTimeSeries.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/plotTimeSeries.py b/examples/plotTimeSeries.py new file mode 100644 index 0000000..28100fe --- /dev/null +++ b/examples/plotTimeSeries.py @@ -0,0 +1,33 @@ +import datetime as dt +import numpy as np + +from silx.gui import qt +from silx.gui.plot import Plot1D, TickMode + + +app = qt.QApplication([]) + +base = dt.datetime.today() +dates = [base - dt.timedelta(days=x) for x in range(0, 50)] + +x = np.array([d.timestamp() for d in dates], dtype=np.uint64) + +np.random.seed(seed=1) +y = np.random.random(x.shape) * 12 - 3 + +plot1D = Plot1D(backend='gl') +xAxis = plot1D.getXAxis() +xAxis.setTickMode(TickMode.TIME_SERIES) +xAxis.setTimeZone('UTC') + +def later(): + xAxis.setTimeZone(dt.timezone(dt.timedelta(hours=12))) + print('set time zone', xAxis.getTimeZone()) + +qt.QTimer.singleShot(4000, later) + +curve = plot1D.addCurve(x=x, y=y, legend='curve') +plot1D.show() + +app.exec_() + |