.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_ts.py: ====================== Plotting a time series ====================== Visualizing data is important and should usually be the first step in any analysis. This simple example shows how to plot a single time series. .. image:: /auto_examples/images/sphx_glr_plot_ts_001.png :class: sphx-glr-single-img .. code-block:: default # Author: Johann Faouzi # License: BSD-3-Clause import numpy as np import matplotlib.pyplot as plt # Parameters n_samples, n_timestamps = 100, 48 # Toy dataset rng = np.random.RandomState(41) X = rng.randn(n_samples, n_timestamps) # Plot the first time series plt.figure(figsize=(6, 5)) plt.plot(X[0], 'o-') plt.xlabel('Time', fontsize=14) plt.title('Plotting a time series', fontsize=16) plt.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.284 seconds) .. _sphx_glr_download_auto_examples_plot_ts.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: plot_ts.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: plot_ts.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_