arctichoke.plot.seasonal_cycle ============================== .. py:module:: arctichoke.plot.seasonal_cycle Functions --------- .. autoapisummary:: arctichoke.plot.seasonal_cycle.plot_seasonal_cycle arctichoke.plot.seasonal_cycle.multi_seasonal_cycle Module Contents --------------- .. py:function:: plot_seasonal_cycle(datasets: [(str, xarray.DataArray, xarray.Dataset)], variable_id: str = None, take_mean: bool = False, ax: matplotlib.axes.Axes = None, plt_title: str = None, line_labels: [str] = None, line_styles: [str] = '-', xlims: [str, str] = None, ylims: [float, float] = None, c_map: [matplotlib.colors.ListedColormap] = mplcm.viridis_r, c_map_label: str = 'Year', save_as: str = None, test: bool = False, **kwargs) Plot a seasonal cycle of the dataset. Plots a seasonal cycle of the given dataset for the given variable, if applicable. :param datasets: A list of datasets for which to make a plot. :type datasets: list of `str`, `xarray.DataArray`, `xarray.Dataset` :param variable_id: The name of the variable ID to plot. :type variable_id: `str` :param take_mean: Whether to take the mean for each month across all the years. Default is `False`. :type take_mean: `bool`, optional :param ax: The axes on which to plot the data. If `None`, a new figure is created. Default is `None`. :type ax: `matplotlib.axes.Axes`, optional :param plt_title: The title to use for the plot. Default is `None`, which uses a default title for the plot. :type plt_title: `str`, `None`, optional :param line_labels: The labels to use for the lines that are plotted if `take_mean = True`. Default is `None`. :type line_labels: list of `str`, `None`, optional :param line_styles: The line styles to use for the lines that are plotted if `take_mean = True`. Default is `'-'`. :type line_styles: list of `str`, `None`, optional :param xlims: 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. :type xlims: List of `float`, optional :param ylims: 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. :type ylims: List of `float`, optional :param c_map: The color map to use for the different lines so their order is clearer. Default is `matplotlib.cm.viridis_r`, the reverse of `viridis`. :type c_map: `matplotlib.colors.ListedColormap`, optional :param c_map_label: The label to use on the colorbar. If `None`, then the colorbar will have no label. Default is `Year`. :type c_map_label: `str`, `None`, optional :param save_as: The name of the file to which to save the plot. Default is `None`, which doesn't save the plot to a file. :type save_as: `str`, `None`, optional :param test: If `True`, the function exists before making a plot for use in testing. Default is `False`. :type test: `bool`, optional :param \*\*kwargs: Keyword arguments to pass to `xr.DataArray.plot()`. :returns: * If `test` == `False` -- fig ax * If `test` == `True` -- dataset : `xarray.DataArray` .. rubric:: Examples >>> from arctichoke.dataset.field_mean import get_field_mean >>> fldmean_xr = get_field_mean('example_siconc_dataset.nc') >>> from arctichoke.plot.seasonal_cycle import plot_seasonal_cycle >>> plot_seasonal_cycle(dataset = fldmean_xr, variable_id = 'siconc') .. py:function:: multi_seasonal_cycle(source_id: str = 'EC-Earth3P-HR', variable_ids: [str] = ['siconc', 'sithick'], experiment_ids: [str] = ['hist-1950'], time_bounds_lists: dict = {'hist-1950': [[1950, 1959], [2005, 2014]], 'highres-future': [[2015, 2024], [2041, 2050]]}, variant_labels=['r1i1p2f1', 'r2i1p2f1', 'r3i1p2f1'], super_title: str = None, fig_scale: (int, float) = 2, save_as: str = None, test: bool = False, **kwargs) Plot multiple seasonal cycles of different datasets. Plots a seasonal cycle for each combination of parameters. Different experiments get their own axes, as well as different variables. Multiple time bounds and variant labels are plotted on the same axes. :param source_id: The name of the `source_id` to specify the model to plot. :type source_id: `str` :param variable_ids: The variable ID(s) to plot. :type variable_ids: list of `str` :param experiment_ids: The experiment(s) to plot. Default is `['hist-1950']`. :type experiment_ids: list of `str`, optional :param time_bounds_lists: A dictionary of the time bounds within which to plot. Each key in the dictionary is the name of an experiment and each value is a list of pairs of years. These time bounds will be passed to `select_files_by_time()`. Default is shown above. :type time_bounds_lists: `dict`, optional :param variant_labels: The variant label(s) to plot for each subplot. Default is shown above. :type variant_labels: list of `str`, optional :param super_title: The title for the overall figure. Default is `None`. :type super_title: `str`, `None`, optional :param fig_scale: The scale factor by which to resize the figure. Default is `2`. :type fig_scale: `int`, `float`, optional :param save_as: The name of the file to which to save the plot. Default is `None`, which doesn't save the plot to a file. :type save_as: `str`, `None`, optional :param test: If `True`, the function exists before making a plot for use in testing. Default is `False`. :type test: `bool`, optional :param \*\*kwargs: Keyword arguments to pass to `xr.DataArray.plot()`. :rtype: `None` .. rubric:: Examples >>> from arctichoke.plot.seasonal_cycle import multi_seasonal_cycle >>> multi_seasonal_cycle( source_id = 'EC-Earth3P-HR', variable_ids = ['siconc'], super_title = 'Seasonal Cycles', )