diff --git a/src/scientific_plots/__init__.py b/src/scientific_plots/__init__.py index c500bae615e91eb8956e1c680137841be6a22bea..d607b78127b2bd2a2b847875d12327048ccc08e9 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.6" +__version__ = "1.8.7" diff --git a/src/scientific_plots/plot_settings.py b/src/scientific_plots/plot_settings.py index 9c59947e644b87bc0da515afda254b7b623671e8..50538ab23df4fb1af9c42cc8c587d0aecc7ac33f 100644 --- a/src/scientific_plots/plot_settings.py +++ b/src/scientific_plots/plot_settings.py @@ -506,6 +506,20 @@ def supress_warnings(plot_function: Callable[Params, None])\ return wrapped_function +def supress_all_warnings(plot_function: Callable[Params, None])\ + -> Callable[Params, None]: + """Supress all warnings given by the called function.""" + @wraps(plot_function) + def wrapped_function( + *args: Params.args, **kwargs: Params.kwargs) -> None: + """Wrapped function without all of the warnings.""" + with catch_warnings(): + simplefilter("ignore") + plot_function(*args, **kwargs) + + return wrapped_function + + @overload def apply_styles(plot_function: Callable[Params, None], *, three_d: bool = False, @@ -567,6 +581,7 @@ def apply_styles(plot_function: Optional[Callable[Params, None]] = None, *, errors = (OSError, FileNotFoundError, ThreeDPlotException, FallBackException) + @supress_all_warnings def journal() -> None: """Create a plot for journals.""" set_rwth_colors(three_d) @@ -576,6 +591,7 @@ def apply_styles(plot_function: Optional[Callable[Params, None]] = None, *, _plot_function(*args, **kwargs) plt.close("all") + @supress_all_warnings def sans_serif() -> None: """ Create a plot for journals with sans-serif-fonts. @@ -587,6 +603,7 @@ def apply_styles(plot_function: Optional[Callable[Params, None]] = None, *, _plot_function(*args, **kwargs) plt.close("all") + @supress_all_warnings def grayscale() -> None: """ Create a plot in grayscales for disserations. @@ -605,6 +622,7 @@ def apply_styles(plot_function: Optional[Callable[Params, None]] = None, *, _plot_function(*args, **new_kwargs) plt.close("all") + @supress_all_warnings def presentation() -> None: """ Create a plot for presentations.