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

Label of plots in legend #197

Open
maestapereira opened this issue Feb 8, 2024 · 0 comments
Open

Label of plots in legend #197

maestapereira opened this issue Feb 8, 2024 · 0 comments

Comments

@maestapereira
Copy link
Collaborator

I was trying to mix plt plot functions with spiketools plot functions and manually add a legend and noticed the spiketools plot function label did not work properly.

Here are the scenarios:

  1. Weird legend:
ax = get_grid_subplot(grid, 1, slice(0, 3))
a1 = ax.plot(trace_times, trace_values, label='trace')
a2 = plot_scatter(spike_times, np.zeros(len(spike_times)), c='r', ax=ax, label='spikes')
ax.legend([a1, a2])

This shows a legend, but the spiketools plot has no label and the plt plot has a weird label (not "trace").

  1. No legend entirely:
ax = get_grid_subplot(grid, 1, slice(0, 3))
a1 = ax.plot(trace_times, trace_values)
a2 = plot_scatter(spike_times, np.zeros(len(spike_times)), c='r', ax=ax)
ax.legend([a1, a2], ['trace', 'spikes'])

Which doesn't show a legend (just a tiny square where the legend is supposed to be. Adding the handles= and labels= to the above code in ax.legend also shoes no legend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant