diff --git a/src/scientific_plots/__init__.py b/src/scientific_plots/__init__.py index 0d1ba1d342f5f4b764a76a38b1b9896f47e5f660..76e05354ea4cc6273fa923702cc4c31667b2defd 100644 --- a/src/scientific_plots/__init__.py +++ b/src/scientific_plots/__init__.py @@ -5,4 +5,4 @@ useful across several different projects and repositories. It also contains stub-files with several data-type annotations for scipy and matplot-lib functions.""" -__version__ = "1.8.1" +__version__ = "1.8.2" diff --git a/src/scientific_plots/default_plots.py b/src/scientific_plots/default_plots.py index 17c4d22dde99f4a5d65e0e4a6fd970f1b83d9fdd..00b76b178666a5baa8b4955547ba8d87f030262b 100644 --- a/src/scientific_plots/default_plots.py +++ b/src/scientific_plots/default_plots.py @@ -24,6 +24,7 @@ mpl.use("Agg") In = TypeVar("In", List[float], Tuple[float], Vector) +# pylint: disable=invalid-name In2D = TypeVar("In2D", List[List[float]], List[Vector], Tuple[Vector], Matrix) @@ -239,6 +240,7 @@ def plot_surface(X: In2D, Y: In2D, Z: In2D, antialiased: bool = True, rcount: int = 200, ccount: int = 200) -> None: """create a 2D surface plot of meshgrid-like valued Xs, Ys and Zs""" + # pylint: disable=too-many-branches if not check_inputs( np.array(X).flatten(), np.array(Z).flatten(), xlabel, zlabel): @@ -409,8 +411,8 @@ def two_plots(x1: In, y1: In, label1: str, if xlim is not None: pass elif outer: - xlim = (min(min(x1), min(x2)), - max(max(x1), max(x2))) + xlim = (min(*x1, *x2), + max(*x1, *x2)) else: xlim = (max(min(x1), min(x2)), min(max(x1), max(x2))) @@ -473,8 +475,8 @@ def three_plots(x1: In, y1: In, label1: str, plt.plot(x3, y3, label=label3, linestyle="dotted") plt.xlabel(xlabel) plt.ylabel(ylabel) - min_ = min(min(y1), min(y2), min(y3)) - max_ = max(max(y1), max(y2), max(y3)) + min_ = min(*y1, *y2, *y3) + max_ = max(*y1, *y2, *y3) if not logscale: plt.ylim( min_ - (max_ - min_) * 0.02, diff --git a/src/scientific_plots/plot_settings.py b/src/scientific_plots/plot_settings.py index 95eca75fca74f84d7708f30ba60e41a8c771e620..ed49b62da97a8eb3e0a729d8f907f26f9af1a6d3 100644 --- a/src/scientific_plots/plot_settings.py +++ b/src/scientific_plots/plot_settings.py @@ -18,6 +18,8 @@ from pathlib import Path from warnings import warn, catch_warnings, simplefilter from textwrap import dedent +# pylint: disable=unused-import +import scienceplots # noqa: F401 import mpl_toolkits import matplotlib as mpl import matplotlib.pyplot as plt diff --git a/src/scientific_plots/utilities.py b/src/scientific_plots/utilities.py index 512d61f1a47c15398ab1e4d10737e03a90155846..af8c645e8a34a8ab7e0be38a46021267255b543c 100644 --- a/src/scientific_plots/utilities.py +++ b/src/scientific_plots/utilities.py @@ -145,7 +145,7 @@ def write_file(filename: Union[Path, str], """write the rows given in 'arga' to a file""" # write data to a file if not any(args[0]): - raise Exception("Tried to write an empty row to a file") + raise ValueError("Tried to write an empty row to a file.") if isinstance(filename, str): filename = Path(filename) with open(filename, "w", encoding="utf-8") as output_file: