.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/dataset/visualization/plot_lines.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_examples_dataset_visualization_plot_lines.py: Lines ===== .. GENERATED FROM PYTHON SOURCE LINES 26-37 .. code-block:: Python from __future__ import annotations from numpy import cos from numpy import linspace from numpy import pi from numpy import sin from gemseo.datasets.dataset import Dataset from gemseo.post.dataset.lines import Lines .. GENERATED FROM PYTHON SOURCE LINES 38-40 Build a dataset --------------- .. GENERATED FROM PYTHON SOURCE LINES 40-49 .. code-block:: Python inputs = linspace(0, 1, 10)[:, None] outputs_1 = sin(2 * pi * inputs) outputs_2 = cos(2 * pi * inputs) dataset = Dataset() dataset.add_variable("x", inputs, "inputs") dataset.add_variable("y1", outputs_1, "outputs") dataset.add_variable("y2", outputs_2, "outputs") .. GENERATED FROM PYTHON SOURCE LINES 50-53 Plot y1 and y2 -------------- We can use the :class:`.Lines` plot. .. GENERATED FROM PYTHON SOURCE LINES 53-57 .. code-block:: Python plot = Lines(dataset, variables=["y1", "y2"]) plot.linestyle = ["--", "-"] plot.execute(save=False, show=True) .. image-sg:: /examples/dataset/visualization/images/sphx_glr_plot_lines_001.png :alt: plot lines :srcset: /examples/dataset/visualization/images/sphx_glr_plot_lines_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [
] .. GENERATED FROM PYTHON SOURCE LINES 58-62 .. tip:: :class:`.Lines` can use plotly to generate an interactive web-based figure. Just set the execution option ``file_format`` to ``"html"``. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.076 seconds) .. _sphx_glr_download_examples_dataset_visualization_plot_lines.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_lines.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_lines.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_lines.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_