Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotting option for flowlines #662

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions py4DSTEM/process/polar/polar_peaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,28 @@ def plot_radial_peaks(
qstep=None,
label_y_axis=False,
figsize=(8, 4),
v_lines=None,
returnfig=False,
):
"""
Calculate and plot the total peak signal as a function of the radial coordinate.

q_pixel_units
If True, plot in reciprocal units instead of pixels.
qmin
The minimum q for plotting.
qmax
The maximum q for plotting.
qstep
The bin width.
label_y_axis
If True, label y axis.
figsize
Plot size.
v_lines: tuple
x coordinates for plotting vertical lines.
returnfig
If True, returns figure.
"""

# Get all peak data
Expand Down Expand Up @@ -741,6 +758,15 @@ def plot_radial_peaks(
if not label_y_axis:
ax.tick_params(left=False, labelleft=False)

if v_lines is not None:
y_min, y_max = ax.get_ylim()

if np.isscalar(v_lines):
ax.vlines(v_lines, y_min, y_max, color="g")
else:
for a0 in range(len(v_lines)):
ax.vlines(v_lines[a0], y_min, y_max, color="g")
Comment on lines +764 to +768
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the if/else isn't necessary - ax.vlines(lines,ymin,ymax) can accept tuples or lists for lines - i.e. we can replace these 5 lines with just line 765


if returnfig:
return fig, ax

Expand Down