gemseo / post / dataset

Show inherited members

plot_settings module

Data for a plot.

class gemseo.post.dataset.plot_settings.PlotSettings(*, color='', colormap='rainbow', fig_size=(6.4, 4.8), font_size=10, legend_location='best', linestyle='', marker='', xtick_rotation=0.0, title='', xlabel='', xmin=None, xmax=None, ylabel='', ymin=None, ymax=None, zlabel='', zmin=None, zmax=None, rmin=None, rmax=None, labels=None, n_items=0, grid=True)[source]

Bases: BaseModel

The settings of a plot.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • color (str | list[str]) –

    By default it is set to “”.

  • colormap (str) –

    By default it is set to “rainbow”.

  • fig_size (tuple[float, float]) –

    By default it is set to (6.4, 4.8).

  • font_size (int) –

    By default it is set to 10.

  • legend_location (str) –

    By default it is set to “best”.

  • linestyle (str | Sequence[str]) –

    By default it is set to “”.

  • marker (str | Sequence[str]) –

    By default it is set to “”.

  • xtick_rotation (float) –

    By default it is set to 0.0.

  • title (str) –

    By default it is set to “”.

  • xlabel (str) –

    By default it is set to “”.

  • xmin (float | None) –

  • xmax (float | None) –

  • ylabel (str) –

    By default it is set to “”.

  • ymin (float | None) –

  • ymax (float | None) –

  • zlabel (str) –

    By default it is set to “”.

  • zmin (float | None) –

  • zmax (float | None) –

  • rmin (float | None) –

  • rmax (float | None) –

  • labels (Mapping[str, str]) –

  • n_items (int) –

    By default it is set to 0.

  • grid (bool) –

    By default it is set to True.

set_colors(color)[source]

Set one color per item if n_items is non-zero or a unique one.

Parameters:

color (str | list[str]) – The color(s).

Return type:

None

set_linestyles(linestyle)[source]

Set the line style(s) if n_items is non-zero or a unique one.

Parameters:

linestyle (str | Sequence[str]) – The line style(s).

Return type:

None

set_markers(marker)[source]

Set the marker(s) if n_items is non-zero or a unique one.

Parameters:

marker (str | Sequence[str]) – The marker(s).

Return type:

None

color: str | list[str]

The color.

Either a global one or one per item if n_items is non-zero.

If empty, use a default one.

colormap: str

The color map.

fig_size: tuple[float, float]

The figure size.

font_size: int

The font size.

grid: bool

Whether to add a grid.

labels: Mapping[str, str]

The labels for the variables.

legend_location: str

The location of the legend.

linestyle: str | Sequence[str]

The line style.

Either a global one or one per item if n_items is non-zero.

If empty, use a default one.

marker: str | Sequence[str]

The marker.

Either a global one or one per item if n_items is non-zero. If empty, use a default one.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'color': FieldInfo(annotation=Union[str, list[str]], required=False, default=''), 'colormap': FieldInfo(annotation=str, required=False, default='rainbow'), 'fig_size': FieldInfo(annotation=tuple[float, float], required=False, default=(6.4, 4.8)), 'font_size': FieldInfo(annotation=int, required=False, default=10), 'grid': FieldInfo(annotation=bool, required=False, default=True), 'labels': FieldInfo(annotation=Mapping[str, str], required=False, default_factory=dict), 'legend_location': FieldInfo(annotation=str, required=False, default='best'), 'linestyle': FieldInfo(annotation=Union[str, Sequence[str]], required=False, default=''), 'marker': FieldInfo(annotation=Union[str, Sequence[str]], required=False, default=''), 'n_items': FieldInfo(annotation=int, required=False, default=0), 'rmax': FieldInfo(annotation=Union[float, NoneType], required=False), 'rmin': FieldInfo(annotation=Union[float, NoneType], required=False), 'title': FieldInfo(annotation=str, required=False, default=''), 'xlabel': FieldInfo(annotation=str, required=False, default=''), 'xmax': FieldInfo(annotation=Union[float, NoneType], required=False), 'xmin': FieldInfo(annotation=Union[float, NoneType], required=False), 'xtick_rotation': FieldInfo(annotation=float, required=False, default=0.0), 'ylabel': FieldInfo(annotation=str, required=False, default=''), 'ymax': FieldInfo(annotation=Union[float, NoneType], required=False), 'ymin': FieldInfo(annotation=Union[float, NoneType], required=False), 'zlabel': FieldInfo(annotation=str, required=False, default=''), 'zmax': FieldInfo(annotation=Union[float, NoneType], required=False), 'zmin': FieldInfo(annotation=Union[float, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

n_items: int

The number of items.

The item definition is specific to the plot type and is used to define properties, e.g. color and line style, for each item.

For example, items can correspond to curves or series of points.

By default, a graph has no item.

rmax: float | None

The maximum value on the r-axis.

If None, compute it from data.

rmin: float | None

The minimum value on the r-axis.

If None, compute it from data.

title: str

The title of the plot.

xlabel: str

The label for the x-axis.

xmax: float | None

The maximum value on the x-axis.”.

If None, compute it from data.

xmin: float | None

The minimum value on the x-axis.

If None, compute it from data.

xtick_rotation: float

The rotation angle in degrees for the x-ticks.

ylabel: str

The label for the y-axis.

ymax: float | None

The maximum value on the y-axis.

If None, compute it from data.

ymin: float | None

The minimum value on the y-axis.

If None, compute it from data.

zlabel: str

The label for the z-axis.

zmax: float | None

The maximum value on the z-axis.

If None, compute it from data.

zmin: float | None

The minimum value on the z-axis.

If None, compute it from data.