.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/dataset/visualization/plot_scatter.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_scatter.py: Scatter ======= .. GENERATED FROM PYTHON SOURCE LINES 26-40 .. code-block:: Python from __future__ import annotations from numpy import linspace from numpy import pi from numpy import sin from gemseo import configure_logger from gemseo.datasets.dataset import Dataset from gemseo.post.dataset.scatter import Scatter configure_logger() .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 41-43 Build a dataset --------------- .. GENERATED FROM PYTHON SOURCE LINES 43-51 .. code-block:: Python inputs = linspace(0, 1, 20)[:, None] outputs = sin(2 * pi * inputs) color = ["b" if abs(output) > 0.5 else "r" for output in outputs] dataset = Dataset() dataset.add_variable("x", inputs, "inputs") dataset.add_variable("y", outputs, "outputs") .. GENERATED FROM PYTHON SOURCE LINES 52-55 Plot y vs x ----------- We can use the :class:`.Scatter` plot .. GENERATED FROM PYTHON SOURCE LINES 55-58 .. code-block:: Python plot = Scatter(dataset, "x", "y") plot.color = color plot.execute(save=False, show=True) .. image-sg:: /examples/dataset/visualization/images/sphx_glr_plot_scatter_001.png :alt: plot scatter :srcset: /examples/dataset/visualization/images/sphx_glr_plot_scatter_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [
] .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.212 seconds) .. _sphx_glr_download_examples_dataset_visualization_plot_scatter.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_scatter.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_scatter.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_scatter.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_