From 14fa0a8b3a83e64dcd32127b7ef2d106268b07ed Mon Sep 17 00:00:00 2001 From: DS_DV Date: Tue, 12 Aug 2025 14:42:17 -0400 Subject: [PATCH] Updated adiabatic.py and base.py I fixed the plotting problem that was happening on Windows --- SuPyMode/representation/adiabatic.py | 10 +--------- SuPyMode/representation/base.py | 6 +++--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/SuPyMode/representation/adiabatic.py b/SuPyMode/representation/adiabatic.py index 5c71e090..5b0e3ab3 100644 --- a/SuPyMode/representation/adiabatic.py +++ b/SuPyMode/representation/adiabatic.py @@ -9,7 +9,6 @@ import numpy from SuPyMode.representation.base import InheritFromSuperMode, BaseMultiModePlot import matplotlib.pyplot as plt -import matplotlib.ticker as ticker class Adiabatic(InheritFromSuperMode, BaseMultiModePlot): @@ -68,16 +67,9 @@ def _dress_ax(self, ax: plt.Axes) -> None: The axis object on which to set the labels. """ ax.set( - yscale='log', xlabel='Inverse taper ratio', ylabel=r'Adiabatic criterion [$\mu$m$^{-1}$]', - ylim=[1e-5 * 1e6, 1 * 1e6], + ylim=[1e-5, 1], ) - def log_scale_yaxis(value, tick_position): - return f'{value / 1e6:.0e}' - - # Apply the custom formatter for log scale - ax.yaxis.set_major_formatter(ticker.FuncFormatter(log_scale_yaxis)) - # - diff --git a/SuPyMode/representation/base.py b/SuPyMode/representation/base.py index 2247050d..272be1c0 100644 --- a/SuPyMode/representation/base.py +++ b/SuPyMode/representation/base.py @@ -47,7 +47,7 @@ def plot(self, other_supermode: SuperMode, ax: plt.Axes = None, show: bool = Tru if not self.parent_supermode.is_computation_compatible(other_supermode): return - y = self.get_values(other_supermode=other_supermode) + y = self.get_values(other_supermode=other_supermode)*1e-6 label = f'{self.parent_supermode.stylized_label} - {other_supermode.stylized_label}' @@ -96,12 +96,12 @@ def plot(self, ax: plt.Axes = None, show: bool = True) -> plt.Figure: else: figure = ax.figure + self._dress_ax(ax) + ax.plot(self.itr_list, self.data, label=f'{self.stylized_label}', linewidth=2) ax.legend() - self._dress_ax(ax) - if show: plt.show()