Skip to content

Commit

Permalink
Add legend to rsgislib.tools.plotting.plot_vec_fields plots.
Browse files Browse the repository at this point in the history
  • Loading branch information
petebunting committed Jan 24, 2024
1 parent 8983cdd commit 0fb2f19
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/rsgislib/tools/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,13 +727,15 @@ def plot_vec_fields(
feat_y_vals = y_vals

if plt_line:
ax.plot(feat_x_vals, feat_y_vals)
ax.plot(feat_x_vals, feat_y_vals, label=f"Feature {feat_id}")
else:
ax.scatter(feat_x_vals, feat_y_vals)
ax.scatter(feat_x_vals, feat_y_vals, label=f"Feature {feat_id}")

ax.set_xlabel(x_lbl)
ax.set_ylabel(y_lbl)
ax.set_title(title)
if feat_id_field is not None:
plt.legend()
fig.tight_layout()
plt.savefig(out_plot_file)

Expand Down

0 comments on commit 0fb2f19

Please sign in to comment.