arctichoke.plot.time_series

Functions

plot_time_series(dataset[, variable_id, plt_title, ...])

Plot a time series of the dataset.

Module Contents

arctichoke.plot.time_series.plot_time_series(dataset: str, xarray.DataArray, xarray.Dataset, variable_id: str = None, plt_title: str = None, xlims: [str, str] = None, ylims: [float, float] = None, save_as: str = None, test: bool = False, **kwargs)

Plot a time series of the dataset.

Plots a time series of the given dataset for the given variable, if applicable.

Parameters:
  • dataset (str, xarray.DataArray, xarray.Dataset) – The dataset for which to make a plot.

  • variable_id (str) – The name of the variable ID to plot.

  • plt_title (str, None, optional) – The title to use for the plot. Default is None, which uses a default title for the plot.

  • xlims (List of float, optional) –

    The limits to use for the x-axis on the plot in the following format:
    • [x_min, x_max]

    where x_min and x_max are strings in the format YYYY-MM-DD Default is None, which expands the x-axis to include all the data.

  • ylims (List of float, optional) –

    The limits to use for the y-axis on the plot in the following format:
    • [y_min, y_max]

    Default is None, which expands the y-axis to include all the data.

  • save_as (str, None, optional) – The name of the file to which to save the plot. Default is None, which doesn’t save the plot to a file.

  • test (bool, optional) – If True, the function exists before making a plot for use in testing. Default is False.

  • **kwargs – Keyword arguments to pass to xr.DataArray.plot().

Returns:

  • If test == FalseNone

  • If test == True – dataset : xarray.DataArray

Examples

>>> from arctichoke.dataset.field_mean import get_field_mean
>>> fldmean_xr = get_field_mean('example_siconc_dataset.nc')
>>> from arctichoke.plot.time_series import plot_time_series
>>> plot_time_series(dataset = fldmean_xr, variable_id = 'siconc')