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

Use a mixed limit condition for a combined plot

parent 00aebc7f
No related branches found
No related tags found
1 merge request!61Use a mixed limit condition for a combined plot
Pipeline #1646121 passed with warnings
...@@ -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.9" __version__ = "1.8.10"
...@@ -367,7 +367,8 @@ def two_plots(x1: In, y1: In, label1: str, ...@@ -367,7 +367,8 @@ def two_plots(x1: In, y1: In, label1: str,
single_log_y: bool = False, single_log_y: bool = False,
xlim: Optional[Tuple[float, float]] = None, xlim: Optional[Tuple[float, float]] = None,
ylim: Optional[Tuple[float, float]] = None, ylim: Optional[Tuple[float, float]] = None,
inner_y: bool = False) -> None: inner_y: bool = False,
half_y: bool = False) -> None:
"""Create a simple 1D plot with two different graphs inside of a single """Create a simple 1D plot with two different graphs inside of a single
plot and a single y-axis. plot and a single y-axis.
...@@ -376,6 +377,7 @@ def two_plots(x1: In, y1: In, label1: str, ...@@ -376,6 +377,7 @@ def two_plots(x1: In, y1: In, label1: str,
color -- use these indeces in the colour-wheel when creating a plot color -- use these indeces in the colour-wheel when creating a plot
outer -- use the outer limits on the x-axis rather than the inner limit outer -- use the outer limits on the x-axis rather than the inner limit
inner_y -- Use the tighter definition for the limits on the y-axis inner_y -- Use the tighter definition for the limits on the y-axis
half_y -- Use the upper upper limit but the upper lower limit
""" """
x1, y1 = fix_inputs(x1, y1) # type: ignore x1, y1 = fix_inputs(x1, y1) # type: ignore
x2, y2 = fix_inputs(x2, y2) # type: ignore x2, y2 = fix_inputs(x2, y2) # type: ignore
...@@ -437,6 +439,10 @@ def two_plots(x1: In, y1: In, label1: str, ...@@ -437,6 +439,10 @@ def two_plots(x1: In, y1: In, label1: str,
plt.ylim( plt.ylim(
max(ylim1[0], ylim2[0]), max(ylim1[0], ylim2[0]),
min(ylim1[1], ylim2[1])) min(ylim1[1], ylim2[1]))
elif half_y:
plt.ylim(
max(ylim1[0], ylim2[0]),
max(ylim1[1], ylim2[1]))
else: else:
plt.ylim( plt.ylim(
min(ylim1[0], ylim2[0]), min(ylim1[0], ylim2[0]),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment