.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/dataset/plot_yvsx.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_dataset_plot_yvsx.py: Plot - YvsX =========== .. GENERATED FROM PYTHON SOURCE LINES 26-39 .. code-block:: default from __future__ import annotations from gemseo.api import configure_logger from gemseo.core.dataset import Dataset from gemseo.post.dataset.yvsx import YvsX from matplotlib import pyplot as plt from numpy import linspace from numpy import pi from numpy import sin configure_logger() .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 40-42 Build a dataset --------------- .. GENERATED FROM PYTHON SOURCE LINES 42-49 .. code-block:: default inputs = linspace(0, 1, 10)[:, None] outputs = sin(2 * pi * inputs) dataset = Dataset() dataset.add_variable("x", inputs, "inputs") dataset.add_variable("y", outputs, "outputs", cache_as_input=False) .. GENERATED FROM PYTHON SOURCE LINES 50-53 Plot y vs x ----------- We can use the :class:`.YvsX` plot .. GENERATED FROM PYTHON SOURCE LINES 53-58 .. code-block:: default plot = YvsX(dataset, "x", "y") plot.linestyle = "--o" plot.execute(save=False, show=False) # Workaround for HTML rendering, instead of ``show=True`` plt.show() .. image-sg:: /examples/dataset/images/sphx_glr_plot_yvsx_001.png :alt: plot yvsx :srcset: /examples/dataset/images/sphx_glr_plot_yvsx_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.135 seconds) .. _sphx_glr_download_examples_dataset_plot_yvsx.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_yvsx.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_yvsx.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_