ogstools.plot.lineplots module#

ogstools.plot.lineplots.line(mesh, var1=None, var2=None, ax=None, **kwargs)[source]#

Plot some data of a (1D) mesh.

You can pass “x”, “y” or “z” to either of x_var or y_var to specify which spatial dimension should be used for the corresponding axis. You can also pass two data variables for a phase plot. if no value is given, automatic detection of spatial axis is tried.

>>> line(mesh)  # z=const: y over x, y=const: z over x, x=const: z over y
>>> line(mesh, ot.variables.temperature)    # temperature over x, y or z
>>> line(mesh, "y", "temperature")          # temperature over y
>>> line(mesh, ot.variables.pressure, "y")  # y over pressure
>>> line(mesh, "pressure", "temperature")   # temperature over pressure
Parameters:
  • mesh (DataSet) – The mesh which contains the data to plot

  • var1 (str | Variable | None) – Variable for the x-axis if var2 is given else for y-axis.

  • var2 (str | Variable | None) – Variable for the y-axis if var1 is given.

  • ax (Axes | None) – The matplotlib axis to use for plotting, if None a new figure will be created.

Keyword Arguments:
  • figsize: figure size (default=[16, 10])

  • color: color of the line

  • linewidth: width of the line

  • linestyle: style of the line

  • label: label in the legend

  • grid: if True, show grid

  • all other kwargs get passed to matplotlib’s plot function

Return type:

Figure | None