Skip to content
Snippets Groups Projects
Commit 2b050fad authored by Felix Fischer's avatar Felix Fischer :shrimp:
Browse files

Added option to only a create a single plot as preview.

parent 1e70278b
Branches
No related tags found
1 merge request!54Added option to only a create a single plot as preview.
Pipeline #1359580 passed
...@@ -93,6 +93,15 @@ All of those functions have the following command-line arguments: ...@@ -93,6 +93,15 @@ All of those functions have the following command-line arguments:
- `xlim`: Set the limits on the x-axis manually. - `xlim`: Set the limits on the x-axis manually.
- `ylim`: Set the limits on the y-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 ## Types
Additional Vector like types for numpy-arrays are provided in Additional Vector like types for numpy-arrays are provided in
`scientifc_plots.types_`. These types can be used for static type checking `scientifc_plots.types_`. These types can be used for static type checking
......
...@@ -5,4 +5,4 @@ useful across several different projects and repositories. It also contains ...@@ -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 stub-files with several data-type annotations for scipy and matplot-lib
functions.""" functions."""
__version__ = "1.8.2" __version__ = "1.8.3"
...@@ -38,6 +38,9 @@ SPINE_COLOR = "black" ...@@ -38,6 +38,9 @@ SPINE_COLOR = "black"
FIGSIZE = (3.15, 2.35) FIGSIZE = (3.15, 2.35)
FIGSIZE_SLIM = (3.15, 2.1) FIGSIZE_SLIM = (3.15, 2.1)
FIGSIZE_SMALL = (2.2, 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 _savefig = copy(plt.savefig) # backup the old save-function
...@@ -532,6 +535,10 @@ def apply_styles(plot_function: Optional[PlotFunction] = None, *, ...@@ -532,6 +535,10 @@ def apply_styles(plot_function: Optional[PlotFunction] = None, *,
plt.savefig = new_save_simple(png=False) plt.savefig = new_save_simple(png=False)
_plot_function(*args, **kwargs) _plot_function(*args, **kwargs)
if PREVIEW:
# don't create the styled plots
return
errors = (OSError, FileNotFoundError, ThreeDPlotException, errors = (OSError, FileNotFoundError, ThreeDPlotException,
FallBackException) FallBackException)
......
...@@ -262,7 +262,9 @@ def translate(string: str, reverse: bool = False) -> str: ...@@ -262,7 +262,9 @@ def translate(string: str, reverse: bool = False) -> str:
"absolute pressure": "Absolutdruck", "absolute pressure": "Absolutdruck",
"relative": "relativ", "relative": "relativ",
"absolute": "absolut", "absolute": "absolut",
"plot": "Graph" "plot": "Graph",
"orifice": "Blende",
"Hagen–Poiseuille": "Hagen-Poiseuille"
}) })
if not reverse and r"\times" not in string: if not reverse and r"\times" not in string:
for key, value in _dict.items(): for key, value in _dict.items():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment