.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "classes/base_classes/data/plot_curve.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_classes_base_classes_data_plot_curve.py: ===== Curve ===== One-dimensional curves as a function of the same axis. The x-axis defines a regular 1D grid. As illustrated in this example, the grid is not necessarily equally spaced. .. code:: @NX_class = "NXroot" @default = "scan1" scan1:NXentry @NX_class = "NXentry" @default = "data" data:NXdata @NX_class = "NXdata" @auxiliary_signals = ["y2"] @axes = ["x"] @signal = "y1" x:NX_INT64[10] y1:NX_FLOAT64[10] y2:NX_FLOAT64[10] Explanation: 1. ``@axes`` has one value which corresponds to the signal rank of one. 2. ``y1`` is the default signal to be plotted versus ``x``. 3. ``y2`` is the only alternative signal to be plotted versus ``x``. .. GENERATED FROM PYTHON SOURCE LINES 35-54 .. image-sg:: /classes/base_classes/data/images/sphx_glr_plot_curve_001.png :alt: plot curve :srcset: /classes/base_classes/data/images/sphx_glr_plot_curve_001.png :class: sphx-glr-single-img .. code-block:: Python # Data import numpy as np x = [0, 1, 8, 30, 35, 150, 200, 340, 500, 520] y1 = 4 + np.sin(2 * np.array(x)) y2 = 2 + np.sin(3 * np.array(x)) # Plot import matplotlib.pyplot as plt # noqa E402 plt.style.use("_mpl-gallery") fig, ax = plt.subplots() ax.plot(x, y1, "o-", label="y1") ax.plot(x, y2, "go-", label="y2") plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.042 seconds) .. _sphx_glr_download_classes_base_classes_data_plot_curve.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_curve.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_curve.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_curve.zip `