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

PlotSlice: add default title #5872

Merged
merged 1 commit into from
Mar 28, 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
8 changes: 8 additions & 0 deletions src/Visualization/Python/PlotSlice.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ def points_on_slice(
" has an effect if multiple files are specified."
),
)
@click.option(
"--title",
"-t",
help="Title for the plot.",
show_default="name of the variable",
)
@apply_stylesheet_command()
@show_or_save_plot_command()
def plot_slice_command(
Expand All @@ -148,6 +154,7 @@ def plot_slice_command(
slice_up,
num_samples,
num_threads,
title,
):
"""Plot variables on a slice through volume data

Expand Down Expand Up @@ -210,6 +217,7 @@ def coord_axis(vec):
x, y, data, colors="white", linewidths=0.5, alpha=0.6
)
plt.clabel(contours)
plt.title(title or var_name)
if np.isclose(slice_extent[0], slice_extent[1]):
plt.gca().set_aspect("equal")
plt.xlabel(x_label)
Expand Down
Loading