diff --git a/readme.md b/readme.md index 79a64220cd3223c0dc3fc8f160da809f49756f0e..36e39c10915eed74e7872de8b08012b3415c1a71 100644 --- a/readme.md +++ b/readme.md @@ -93,6 +93,15 @@ All of those functions have the following command-line arguments: - `xlim`: Set the limits on the x-axis manually. - `ylim`: Set the limits on the y-axis manually. +### Preview-Mode +It is possible to only create a single plot for every called plot function +to save computation time. This 'preview' mode can be called by setting the +following global variable in `scientific_plots.plot_settings` to true: +``` +import scientifc_plots.plot_settings +scientifc_plots.plot_settings.PREVIEW = True +``` + ## Types Additional Vector like types for numpy-arrays are provided in `scientifc_plots.types_`. These types can be used for static type checking diff --git a/src/scientific_plots/__init__.py b/src/scientific_plots/__init__.py index 76e05354ea4cc6273fa923702cc4c31667b2defd..896a8d8e0935bd320279b15c4e0fa20dbf094a5b 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.2" +__version__ = "1.8.3" diff --git a/src/scientific_plots/plot_settings.py b/src/scientific_plots/plot_settings.py index ed49b62da97a8eb3e0a729d8f907f26f9af1a6d3..89a5e64d556b29fe77faf1fa2bb0db71ab32d53c 100644 --- a/src/scientific_plots/plot_settings.py +++ b/src/scientific_plots/plot_settings.py @@ -38,6 +38,9 @@ SPINE_COLOR = "black" FIGSIZE = (3.15, 2.35) FIGSIZE_SLIM = (3.15, 2.1) FIGSIZE_SMALL = (2.2, 2.1) + +PREVIEW = False # Generate only one set of plots, don't create the whole set + _savefig = copy(plt.savefig) # backup the old save-function @@ -532,6 +535,10 @@ def apply_styles(plot_function: Optional[PlotFunction] = None, *, plt.savefig = new_save_simple(png=False) _plot_function(*args, **kwargs) + if PREVIEW: + # don't create the styled plots + return + errors = (OSError, FileNotFoundError, ThreeDPlotException, FallBackException) diff --git a/src/scientific_plots/utilities.py b/src/scientific_plots/utilities.py index af8c645e8a34a8ab7e0be38a46021267255b543c..d4ac4619ac851bb3b3c87c71cb2ba10f337e24e6 100644 --- a/src/scientific_plots/utilities.py +++ b/src/scientific_plots/utilities.py @@ -262,7 +262,9 @@ def translate(string: str, reverse: bool = False) -> str: "absolute pressure": "Absolutdruck", "relative": "relativ", "absolute": "absolut", - "plot": "Graph" + "plot": "Graph", + "orifice": "Blende", + "Hagen–Poiseuille": "Hagen-Poiseuille" }) if not reverse and r"\times" not in string: for key, value in _dict.items():