diff --git a/src/scientific_plots/__init__.py b/src/scientific_plots/__init__.py index 8536ab994295895fc078221ed61f5c867250d327..a1986365e675c8c798cf28a1ecfe46ec78a3334f 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.11" +__version__ = "1.8.12" diff --git a/src/scientific_plots/utilities.py b/src/scientific_plots/utilities.py index a0b642880e37cb5bc48bfc2af1cc540f9dbab90e..ee48262681dc52d2c50cfc88608c84602e875918 100644 --- a/src/scientific_plots/utilities.py +++ b/src/scientific_plots/utilities.py @@ -207,7 +207,7 @@ def translate(string: str, reverse: bool = False) -> str: @input reverse translate ger->en if set to true @return the german translation of the same string""" - if r"$" in string or not string: + if r"$" in string or not string or len(string) <= 1: return string if reverse: @@ -267,7 +267,8 @@ def translate(string: str, reverse: bool = False) -> str: "plot": "Graph", "orifice": "Blende", "Hagen–Poiseuille": "Hagen-Poiseuille", - "test": "Test" + "test": "Test", + "bar": "bar" }) if not reverse and r"\times" not in string: for key, value in _dict.items(): diff --git a/tests/test_plot_manual.py b/tests/test_plot_manual.py index c8a5cf248f18fe29a72ad8824c49d630dac7c167..45b76f99c4ac7865fc2dfdbe63a6d2809ba5d937 100644 --- a/tests/test_plot_manual.py +++ b/tests/test_plot_manual.py @@ -31,7 +31,7 @@ def test_two_plots() -> None: filename.parent.mkdir(exist_ok=True) two_plots(x_test, y_test1, "plot1", x_test, y_test2, "plot2", - "distance", r"$\dot{m} = \frac{a}{b}$ leakage [bar]", + "$p$ distance [m]", r"$\dot{m} = \frac{a}{b}$ leakage [bar]", filename) assert filename.exists() @@ -95,7 +95,7 @@ def test_fallback() -> None: def simple_plot() -> None: """Create a simple plot.""" plt.plot(x_test, y_test, label="test") - plt.xlabel("$x$ [m]") + plt.xlabel("$p$ [bar]") plt.ylabel(r"$\sqrt{y_c}$ [1/m]") plt.legend() plt.gca().set_yscale("log")