From 741f7cd3ae3bf9346ea88ada702790f84184f06f Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:39:30 -0600 Subject: [PATCH] respond to pr review --- .gitignore | 3 +++ src/geocat/viz/taylor.py | 18 +++++++++--------- src/geocat/viz/util.py | 7 +++++-- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index c7aefe82..700f18dd 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ docs/_build/ dist/ .eggs/ *egg-info + +# IDEs +settings.json diff --git a/src/geocat/viz/taylor.py b/src/geocat/viz/taylor.py index bae923ef..d463486f 100644 --- a/src/geocat/viz/taylor.py +++ b/src/geocat/viz/taylor.py @@ -441,12 +441,12 @@ def add_xgrid(self, return self.add_corr_grid(arr, color, linestyle, linewidth, **kwargs) - def add_stdev_grid(self, - arr: typing.Union[xr.DataArray, np.ndarray, list, float], - color: str = 'lightgray', - linestyle=(0, (9, 5)), - linewidth: int = 1, - **kwargs): + def add_std_grid(self, + arr: typing.Union[xr.DataArray, np.ndarray, list, float], + color: str = 'lightgray', + linestyle=(0, (9, 5)), + linewidth: int = 1, + **kwargs): """Add radial gridlines to the standard deviation axis specified by array. @@ -478,7 +478,7 @@ def add_stdev_grid(self, -------- All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the `website `_. - - `NCL_taylor_2.py `_ + - `NCL_taylor_2.py `_ """ t_array = np.linspace(0, np.pi / 2) @@ -501,10 +501,10 @@ def add_ygrid(self, *arr*. - This function will be deprecated in favor of `add_stdev_grid()` + This function will be deprecated in favor of `add_std_grid()` """ - return self.add_stdev_grid(arr, color, linestyle, linewidth, **kwargs) + return self.add_std_grid(arr, color, linestyle, linewidth, **kwargs) def add_grid(self, *args, **kwargs): """Add a grid. diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 397c9ea6..d0a3bb13 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -556,7 +556,7 @@ def set_titles_and_labels(ax: typing.Union[matplotlib.axes.Axes, >>> | Axes | >>> | | - Be aware that the `suptitle` functionality does not automaticallly render well for Cartopy plots. Recommended fixes are to iterate on your figure size until it does not extend as far past your plot OR to use string manipulation to add enough spaces to center your left or right title keyword argument. + Be aware that the `suptitle` functionality does not always render well for Cartopy plots. If your main title appears too far above your plot, the recommended fix is to decrease the y-dimension of your figure size. Examples -------- @@ -573,7 +573,10 @@ def set_titles_and_labels(ax: typing.Union[matplotlib.axes.Axes, if maintitle is not None: if subtitle is not None: fig = ax.get_figure() - fig.suptitle(maintitle, fontsize=maintitlefontsize, y=1.04) + fig.suptitle(maintitle, + fontsize=maintitlefontsize, + y=1.04, + ha='center') elif lefttitle is not None or righttitle is not None: ax.set_title(maintitle, fontsize=maintitlefontsize + 2, y=1.12) else: