-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
legend marker update bug #2035
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
Comments
This is related to #2532 and the fact that only one artists is returned from the legend key. |
Reproduced on python 2.7.12, matplotlib 1.5.3 Thanks for the excellent code to repro |
Is this still a bug? I'm using v3.0.1 with Python 3.6.6 and I'm finding that the marker color doesn't update.
|
I suppose this would be fixed by #11358, which is still work in progress. If you are really in desperate need to do the manipulation without going through the legend creation (again), you may crawl your way through the packers and set the colors of the artists directly.
|
Yes, I have a simpler workaround by just plotting the marker styles I want some where far away on the graph and fixing the axis limits. But I probably spent more time figuring out that this was a bug and not me being confused than hacking it....haha... |
@eltrompetero Sorry, I should have been clearer in my last comment. The workaround is meant for cases where you want to manipulate the legend after it being created. This might be useful in cases as the original issue, or when you have complex functions you don't want to change for the purpose, or when working with downstream libraries which hide the legend creation from you like seaborn, pandas etc. If, however, you have full control over the legend generation, you would just create the legend with the handle you want to show. This is (hopefully) described in the legend guide. So in your case from above, you would create the legend with a black line from the start:
That being said, if you have a suggestion on how to improve the legend guide or other documentation, which would have prevented you from spending too much time on this, we're all ears. |
Okay. Thanks! Didn't read your comment carefully enough. |
Any patch available ? My program relies on pandas/matplotlib and the legend is systematically wrong because of this. |
When a line object is added to the legend without marker, the update works fine both on data and legend line, but with marker it does not refresh the legend line's marker:
I understand that lines and markers are drawn separately to support special legend patterns, but this is somehow not the case when line is originally added to the legend without marker. Please align legend line and marker property updates.
python 2.7.4 win32
matplotlib 1.2.1
originally reported on mpl-users:
http://matplotlib.1069221.n5.nabble.com/legend-marker-update-problem-tc41070.html
The text was updated successfully, but these errors were encountered: