From 0c43a6250c632deafe7e8ac1e353257c853e894f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:33:00 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/mplhep/plot.py | 10 +++++++--- tests/test_basic.py | 22 +++++++++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/mplhep/plot.py b/src/mplhep/plot.py index b7453c41..6cf08c6b 100644 --- a/src/mplhep/plot.py +++ b/src/mplhep/plot.py @@ -4,7 +4,7 @@ import inspect import warnings from collections import OrderedDict, namedtuple -from typing import TYPE_CHECKING, Any, Union, List +from typing import TYPE_CHECKING, Any, List, Union import matplotlib as mpl import matplotlib.pyplot as plt @@ -299,7 +299,7 @@ def histplot( else: _labels = [str(lab) for lab in label] - _colors: List + _colors: list if colors is None: _colors = [None] * len(plottables) elif isinstance(colors, str): @@ -473,7 +473,11 @@ def iterable_not_string(arg): if _colors[i] is not None: _plot_info["color"] = _colors[i] _f = ax.stairs( - **_plot_info, **plottables[i].to_stairs(), label=_labels[i], fill=True, **_kwargs + **_plot_info, + **plottables[i].to_stairs(), + label=_labels[i], + fill=True, + **_kwargs, ) return_artists.append(StairsArtists(_f, None, None)) _artist = _f diff --git a/tests/test_basic.py b/tests/test_basic.py index 12be9637..5e112bc7 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -568,11 +568,27 @@ def test_histplot_inputs_pass(h, yerr, htype): def test_color(): hs, bins = [[2, 3, 4], [5, 4, 3]], [0, 1, 2, 3] fig, axs = plt.subplots(3, 2, figsize=(8, 12)) - colors = ['green', 'blue'] + colors = ["green", "blue"] axs = axs.flatten() for i, htype in enumerate(["step", "fill", "errorbar"]): - hep.histplot(hs[0], bins, yerr=True, histtype=htype, ax=axs[i * 2], alpha=0.7, color='red') - hep.histplot(hs, bins, yerr=True, histtype=htype, ax=axs[i * 2 + 1], alpha=0.7, color=colors) + hep.histplot( + hs[0], + bins, + yerr=True, + histtype=htype, + ax=axs[i * 2], + alpha=0.7, + color="red", + ) + hep.histplot( + hs, + bins, + yerr=True, + histtype=htype, + ax=axs[i * 2 + 1], + alpha=0.7, + color=colors, + ) return fig