ogstools.plot.lineplots module#
- ogstools.plot.lineplots.line(dataset, var1=None, var2=None, ax=None, sort=True, outer_legend=False, **kwargs)[source]#
Plot some data of a (1D) dataset.
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. By passing “time” the timevalues will be use for this 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(ms, ot.variables.temperature) # temperature over time >>> line(ms, ot.variables.temperature, "time") # time over temperature >>> line(ms, "pressure", "temperature") # temperature over pressure >>> 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) # z=const: y over x, y=const: z over x, x=const: z over y
- Parameters:
dataset (DataSet | Sequence[DataSet]) – The mesh or meshseries 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.
sort (bool) – Automatically sort the values along the dimension of the mesh with the largest extent
- Outer_legend:
Draw legend to the right next to the plot area. By default False (legend stays inside). User can pass a tuple of two floats (x, y), which will be passed to bbox_to_anchor parameter in matplotlib legend call. True will pass the default values (1.05, 1.0).
- Return type:
Figure | None
- 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
monospace: if True, the legend uses a monospace font
loc: location of the legend (default=”upper right”)
annotate: string to be annotate at the center of the mesh
- clip_on: If True, clip the output to stay within the Axes.
(default=False)
all other kwargs get passed to matplotlib’s plot function
- Note:
Using loc=”best” will take a long time, if you plot lines on top of a contourplot, as matplotlib is calculating the best position against all the underlying cells.