Skip to content

Commit

Permalink
Use SETTINGS.plot_show_legend everywhere (fixes: #707) (#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelGrupp authored Dec 6, 2024
1 parent d91c158 commit 2ebd3b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions evo/main_res.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ def run(args: argparse.Namespace) -> None:
# handle NaNs from concat() above
error_df.interpolate(method="index", limit_area="inside").plot(
ax=fig_raw.gca(), colormap=colormap, style=linestyles,
title=first_title, alpha=SETTINGS.plot_trajectory_alpha)
title=first_title, alpha=SETTINGS.plot_trajectory_alpha,
legend=SETTINGS.plot_show_legend)
plt.xlabel(index_label)
plt.ylabel(metric_label)
plt.legend(frameon=True)
plot_collection.add_figure("raw", fig_raw)

# statistics plot
Expand All @@ -200,9 +200,9 @@ def run(args: argparse.Namespace) -> None:
include = df.loc["stats"].index.isin(SETTINGS.plot_statistics)
if any(include):
df.loc["stats"][include].plot(kind="barh", ax=fig_stats.gca(),
colormap=colormap, stacked=False)
colormap=colormap, stacked=False,
legend=SETTINGS.plot_show_legend)
plt.xlabel(metric_label)
plt.legend(frameon=True)
plot_collection.add_figure("stats", fig_stats)

# grid of distribution plots
Expand Down
6 changes: 4 additions & 2 deletions evo/tools/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,9 @@ def traj_colormap(ax: Axes, traj: trajectory.PosePath3D, array: ListOrArray,
"{0:0.3f}".format(max_map)
])
if title:
ax.legend(frameon=True)
ax.set_title(title)
if SETTINGS.plot_show_legend:
ax.legend(frameon=True)
if plot_start_end_markers:
add_start_end_markers(ax, plot_mode, traj, start_color=colors[0],
end_color=colors[-1])
Expand Down Expand Up @@ -787,7 +788,8 @@ def error_array(ax: Axes, err_array: ListOrArray,
plt.ylabel(ylabel if ylabel else name)
plt.xlabel(xlabel)
plt.title(title)
plt.legend(frameon=True)
if SETTINGS.plot_show_legend:
plt.legend(frameon=True)


def ros_map(
Expand Down

0 comments on commit 2ebd3b8

Please sign in to comment.