From ea5c1e03d5355a62412badc5602a33a79bca5a80 Mon Sep 17 00:00:00 2001 From: James Frost Date: Fri, 23 Aug 2024 09:46:31 +0100 Subject: [PATCH] Return CubeList from scatter plot operator --- src/CSET/operators/plot.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/CSET/operators/plot.py b/src/CSET/operators/plot.py index 74baac78a..64ae0eca7 100644 --- a/src/CSET/operators/plot.py +++ b/src/CSET/operators/plot.py @@ -1071,7 +1071,7 @@ def scatter_plot( filename: str = None, one_to_one: bool = True, **kwargs, -) -> tuple[iris.cube.Cube, iris.cube.Cube]: +) -> iris.cube.CubeList[iris.cube.Cube, iris.cube.Cube]: """Plot a scatter plot between two variables. Both cubes must be 1D. @@ -1085,15 +1085,12 @@ def scatter_plot( filename: str, optional Filename of the plot to write. one_to_one: bool, optional - If True a 1:1 line is plotted; if False it is not. - Default is True. + If True a 1:1 line is plotted; if False it is not. Default is True. Returns ------- - cube_x - The original x cube (so further operations can be applied). - cube_y - The original y cube (so further operations can be applied). + cubes: CubeList + CubeList of the original x and y cubes for further processing. Raises ------ @@ -1106,18 +1103,17 @@ def scatter_plot( Notes ----- Scatter plots are used for determining if there is a relationship between - two variables. Positive relations have a slope going from bottom left to - top right; Negative relations have a slope going from top left to bottom - right. + two variables. Positive relations have a slope going from bottom left to top + right; Negative relations have a slope going from top left to bottom right. A variant of the scatter plot is the quantile-quantile plot. This plot does not use all data points, but the selected quantiles of each variable instead. Quantile-quantile plots are valuable for comparing against observations and other models. Identical percentiles between the variables will lie on the one-to-one line implying the values correspond well to each - other. Where there is a deviation from the one-to-one line a range - of possibilities exist depending on how and where the data is shifted - (e.g., Wilks 2011 [Wilks2011]_). + other. Where there is a deviation from the one-to-one line a range of + possibilities exist depending on how and where the data is shifted (e.g., + Wilks 2011 [Wilks2011]_). For distributions above the one-to-one line the distribution is left-skewed; below is right-skewed. A distinct break implies a bimodal distribution, and @@ -1155,7 +1151,7 @@ def scatter_plot( # Make a page to display the plots. _make_plot_html_page(plot_index) - return cube_x, cube_y + return iris.cube.CubeList([cube_x, cube_y]) def plot_histogram_series(