diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 466705af..7da980c7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,7 +5,9 @@ Changelog v0.17.0 (unreleased) -------------------- -* Updated the cookiecutter template to the latest commit and synchronized dependencies between PyPI and Anaconda recipes. (PR #427). +* Updated the cookiecutter template to the latest commit and synchronized dependencies between PyPI and Anaconda recipes. (PR #427) +* Updated `ts_fit_graph` logic for `matplotlib` >= 3.10.0 compatibility. (PR #434) +* Temporarily pinned `pygments` below v2.19 due to a breaking change affecting `sphinx-codeautolink`. (PR #434) v0.16.1 (2024-12-05) -------------------- diff --git a/environment-rtd.yml b/environment-rtd.yml index 9b6ff3ed..2fe24f24 100644 --- a/environment-rtd.yml +++ b/environment-rtd.yml @@ -25,7 +25,7 @@ dependencies: - notebook - pandoc - pydantic >=2.0 - - pygments + - pygments <2.19 # FIXME: Newest pygments breaks sphinx-codeautolink. See: https://github.com/felix-hilden/sphinx-codeautolink/issues/153 - salib - seaborn - sphinx >=7.0.0 diff --git a/pyproject.toml b/pyproject.toml index 3f79e053..615ddeba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,7 +114,7 @@ docs = [ "myst_nb", "nbsphinx", "numpydoc >=1.8.0", - "pygments", + "pygments <2.19", # FIXME: Newest pygments breaks sphinx-codeautolink. See: https://github.com/felix-hilden/sphinx-codeautolink/issues/153 "pymetalink >=6.5.2", "salib", "s3fs", diff --git a/src/ravenpy/utilities/graphs.py b/src/ravenpy/utilities/graphs.py index 9fcadb0a..339b2be6 100644 --- a/src/ravenpy/utilities/graphs.py +++ b/src/ravenpy/utilities/graphs.py @@ -330,7 +330,7 @@ def ts_fit_graph(ts: xr.DataArray, params: xr.DataArray) -> matplotlib.pyplot.Fi fig, axes = plt.subplots(n, figsize=(10, 6), squeeze=False) if params.isnull().any(): - raise ValueError("Null values in `params`.") + raise ValueError("Null values found in `params`.") for i in range(n): ax = axes.flat[i] @@ -348,9 +348,9 @@ def ts_fit_graph(ts: xr.DataArray, params: xr.DataArray) -> matplotlib.pyplot.Fi ) ax2.hist( t, + facecolor="none", bins=bins, - facecolor=(1, 1, 1, 0.01), - edgecolor="gray", + edgecolor="grey", linewidth=1, ) @@ -362,7 +362,7 @@ def ts_fit_graph(ts: xr.DataArray, params: xr.DataArray) -> matplotlib.pyplot.Fi pdf = dc.pdf(q) ps = ", ".join([f"{x:.1f}" for x in p.values]) - ax.plot(q, pdf, "-", label="{}({})".format(params.attrs["scipy_dist"], ps)) + ax.plot(q, pdf, "-", label=f"{params.attrs['scipy_dist']}({ps})") # Labels ax.set_xlabel(f"{ts.long_name} (${units2pint(ts.units):~P}$)") diff --git a/tests/test_graphs.py b/tests/test_graphs.py index aa9186dd..158af224 100644 --- a/tests/test_graphs.py +++ b/tests/test_graphs.py @@ -1,7 +1,7 @@ from shutil import copyfile import numpy as np -import xarray as xr +from xarray import open_dataset from xclim import set_options from xclim.indicators.generic import fit, stats @@ -17,7 +17,7 @@ def test_ts_fit_graph(self, get_local_testdata, tmp_path): copyfile(raven_hydrograph, file) - with xr.open_dataset(file) as ds: + with open_dataset(file) as ds: ts = stats(ds.q_sim, op="max", freq="ME") with set_options(check_missing="skip"): p = fit(ts)