Source code for libs.utility_functions.plot_utilities
"""
Copyright (c) 2024 MPI-M, Clara Bayley
----- Microphysics Test Cases -----
File: plot_utilities.py
Project: utility_functions
Created Date: Monday 2nd September 2024
Author: Clara Bayley (CB)
Additional Contributors:
-----
Last Modified: Wednesday 4th September 2024
Modified By: CB
-----
License: BSD 3-Clause "New" or "Revised" License
https://opensource.org/licenses/BSD-3-Clause
-----
File Description:
Helpful functions for plotting
"""
from ..thermo.output_thermodynamics import OutputThermodynamics
[docs]
def plot_thermodynamics_output_timeseries(ax, out: OutputThermodynamics, var: str):
"""
Plot a variable against time on an axis.
Args:
ax (matplotlib.axes.Axes): The (x-y) axis on which to plot the variable.
out (OutputThermodynamics): OutputThermodynamics containing time (x axis)
and OutputVaribale "var" (y axis).
var (str): Name of the variable to be plotted (y axis).
Returns:
None
"""
ax.plot(out.time.values, out[var].values)
ax.set_ylabel(out[var].name + " /" + out[var].units)