Skip to content

Commit

Permalink
Add xlim options
Browse files Browse the repository at this point in the history
  • Loading branch information
Talon Chandler committed Nov 7, 2022
1 parent b7f307e commit c324a98
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions polaris/spang.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c324a98

Please sign in to comment.