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
legend do not work without handles #188
Comments
Thanks for the report, this is fixed now. Another issue that highlights the need for more robust testing |
Hi @lukelbd , Is it possible to call
Error:
It would be nice if the legend could directly access the default handles without relying on their generation when plotting... |
Hi @lukelbd This issue still appears when ax.legend(loc='b') Error:
|
@kinyatoride It should be fixed on master; do you have the "development" version? Can be installed with |
This issue appears again in the development version (0.8.0.post5). Error:
|
Thanks, this was another quick fix (fdd53a6). The refactors in v0.8 had been hanging over my head for 2 years -- now that they're finally done the next step is obviously to add many many more automated tests (goal for the end of 2021). import proplot as plot
fig, ax = plot.subplots()
ax.plot([0, 1, 2], label='a')
ax.plot([0, 1, 1], label='b')
ax.legend() import proplot as plot
fig, ax = plot.subplots()
ax.plot([0, 1, 2])
ax.plot([0, 1, 1])
ax.legend(labels=['a', 'b']) |
Description
There seem to be issues with
get_legend_handles_labels
when no handles are passed toax.legend
.It would be better if this works as sometimes making handles are cumbersome.
Steps to reproduce
Expected behavior: [What you expected to happen]
legend shows up
Actual behavior: [What actually happened]
ValueError Traceback (most recent call last)
in
4 ax.plot([0, 1, 2], label='a')
5 ax.plot([0, 1, 1], label='b')
----> 6 ax.legend()
~/miniconda3/envs/basic2/lib/python3.7/site-packages/proplot/ui.py in _iterator(*args, **kwargs)
680 result = []
681 for func in objs:
--> 682 result.append(func(*args, **kwargs))
683 if len(self) == 1:
684 return result[0]
~/miniconda3/envs/basic2/lib/python3.7/site-packages/proplot/axes/base.py in legend(self, loc, width, space, *args, **kwargs)
1399
1400 # Draw legend
-> 1401 return legend_wrapper(self, *args, loc=loc, **kwargs)
1402
1403 def draw(self, renderer=None, *args, **kwargs):
~/miniconda3/envs/basic2/lib/python3.7/site-packages/proplot/axes/plot.py in legend_wrapper(self, handles, labels, ncol, ncols, center, order, loc, label, title, fontsize, fontweight, fontcolor, color, marker, lw, linewidth, dashes, linestyle, markersize, frameon, frame, **kwargs)
3137 if list_of_lists:
3138 if any(not np.iterable(_) for _ in handles):
-> 3139 raise ValueError(f'Invalid handles={handles!r}.')
3140 if not labels:
3141 labels = [None] * len(handles)
ValueError: Invalid handles=[None].
Equivalent steps in matplotlib
Proplot version
0.63
The text was updated successfully, but these errors were encountered: