Skip to content

Commit

Permalink
Return CubeList from scatter plot operator
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrost-mo committed Aug 23, 2024
1 parent 2636cf0 commit ea5c1e0
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/CSET/operators/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
------
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit ea5c1e0

Please sign in to comment.