From c324a98804db3ac6f0898092d34a5f0612c0cd53 Mon Sep 17 00:00:00 2001 From: Talon Chandler Date: Sun, 6 Nov 2022 20:21:44 -0800 Subject: [PATCH] Add xlim options --- polaris/spang.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/polaris/spang.py b/polaris/spang.py index e3187b6..acff181 100644 --- a/polaris/spang.py +++ b/polaris/spang.py @@ -628,7 +628,8 @@ def visualize(self, out_path='out/', outer_box=True, axes=True, return my_cam - def vis_profiles(self, filename, profilesi, colors=None, dx=0.13, prof_type='density', markers=True, ylim=[-0.1, 0.1]): + def vis_profiles(self, filename, profilesi, colors=None, dx=0.13, prof_type='density', markers=True, xlim=None, ylim=[-0.1, 0.1]): + print("Generating: "+filename) from scipy.interpolate import interpn out = [] xpos_out = [] @@ -683,9 +684,12 @@ def vis_profiles(self, filename, profilesi, colors=None, dx=0.13, prof_type='den maxx = np.max(np.concatenate(xpos_out)) f, ax = plt.subplots(1, 1, figsize=(1.5,1.5)) - ax.set_xlabel('Position along profile ($\mu$m)') + ax.set_xlabel('Pos. on prof. ($\mu$m)') ax.set_ylabel(ylabel) - ax.set_xlim([-0.05*maxx,maxx]) + if xlim is None: + ax.set_xlim([-0.05*maxx,maxx]) + else: + ax.set_xlim(xlim) ax.set_ylim(ylim) ax.spines['right'].set_visible(False) ax.spines['top'].set_visible(False)