Plot - YvsX

from __future__ import annotations

from gemseo.api import configure_logger
from gemseo.core.dataset import Dataset
from gemseo.post.dataset.yvsx import YvsX
from numpy import linspace
from numpy import pi
from numpy import sin

configure_logger()
<RootLogger root (INFO)>

Build a dataset

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)

Plot y vs x

We can use the YvsX plot

plot = YvsX(dataset, "x", "y")
plot.linestyle = "--o"
plot.execute(save=False, show=True)
plot yvsx
[<Figure size 640x480 with 1 Axes>]

Total running time of the script: ( 0 minutes 0.132 seconds)

Gallery generated by Sphinx-Gallery