{"action":"created","issue":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/9580","repository_url":"https://api.github.com/repos/matplotlib/matplotlib","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/9580/labels{/name}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/9580/comments","events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/9580/events","html_url":"https://github.com/matplotlib/matplotlib/issues/9580","id":268582037,"number":9580,"title":"Broken legend auto-position with step*-type histograms","user":{"login":"afvincent","id":17270724,"avatar_url":"https://avatars1.githubusercontent.com/u/17270724?v=4","gravatar_id":"","url":"https://api.github.com/users/afvincent","html_url":"https://github.com/afvincent","followers_url":"https://api.github.com/users/afvincent/followers","following_url":"https://api.github.com/users/afvincent/following{/other_user}","gists_url":"https://api.github.com/users/afvincent/gists{/gist_id}","starred_url":"https://api.github.com/users/afvincent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afvincent/subscriptions","organizations_url":"https://api.github.com/users/afvincent/orgs","repos_url":"https://api.github.com/users/afvincent/repos","events_url":"https://api.github.com/users/afvincent/events{/privacy}","received_events_url":"https://api.github.com/users/afvincent/received_events","type":"User","site_admin":false},"labels":[{"id":174402470,"url":"https://api.github.com/repos/matplotlib/matplotlib/labels/Difficulty:%20Hard","name":"Difficulty: Hard","color":"e11d21","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/25","html_url":"https://github.com/matplotlib/matplotlib/milestone/25","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/25/labels","id":2189521,"number":25,"title":"v2.2","description":"","creator":{"login":"tacaswell","id":199813,"avatar_url":"https://avatars3.githubusercontent.com/u/199813?v=4","gravatar_id":"","url":"https://api.github.com/users/tacaswell","html_url":"https://github.com/tacaswell","followers_url":"https://api.github.com/users/tacaswell/followers","following_url":"https://api.github.com/users/tacaswell/following{/other_user}","gists_url":"https://api.github.com/users/tacaswell/gists{/gist_id}","starred_url":"https://api.github.com/users/tacaswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tacaswell/subscriptions","organizations_url":"https://api.github.com/users/tacaswell/orgs","repos_url":"https://api.github.com/users/tacaswell/repos","events_url":"https://api.github.com/users/tacaswell/events{/privacy}","received_events_url":"https://api.github.com/users/tacaswell/received_events","type":"User","site_admin":false},"open_issues":841,"closed_issues":63,"state":"open","created_at":"2016-12-11T20:54:18Z","updated_at":"2017-10-26T18:10:34Z","due_on":"2018-01-30T08:00:00Z","closed_at":null},"comments":5,"created_at":"2017-10-25T23:23:55Z","updated_at":"2017-10-26T23:30:33Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nAutomatic placing of legend seems to be not working with histograms of type `step*`. If I am correct, this is a new entry in the long list of current issues with legend ^^.\r\n\r\n**Code for reproduction**\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\n\r\nhist_types = ('bar', 'barstacked', 'step', 'stepfilled')\r\n\r\nfig, axs = plt.subplots(nrows=len(hist_types), num=\"test\")    \r\nfor ax, ht in zip(axs.flat, hist_types):\r\n    ax.set_title(ht)\r\n    ax.hist([0] + 5*[9], bins=range(10), label=f\"This is a label\", histtype=ht)               \r\n    ax.legend(loc=\"best\")\r\n\r\nfig.tight_layout()\r\n#fig.savefig(fig.get_label() + \".png\")\r\n```\r\n\r\n**Actual outcome**\r\n\r\nMatplotlib 2.1\r\n\r\n![test](https://user-images.githubusercontent.com/17270724/32027748-94a8a666-b99f-11e7-99d2-547a51ed6142.png)\r\n\r\n**Expected outcome**\r\n\r\nThe same auto-position of the legend on each subplot, i.e. *upper left*, whatever is the histogram style.\r\n\r\n**Matplotlib version**\r\n\r\n  * Operating system: GNU/Linux (Fedora 26)\r\n  * Matplotlib version: 2.1 from conda (also test “successfully” with master)\r\n  * Matplotlib backend (`print(matplotlib.get_backend())`): Qt5Agg\r\n  * Python version: 3.6.3 from conda\r\n  * Jupyter version (if applicable): X\r\n  * Other libraries:  X\r\n\r\n*FWIW, I tried the above snippet on Matplotlib 1.5.0 and the result is similar.*\r\n\r\n**Edit:** tweaked a bit the snippet to be Matplotlib v1.5.x-compliant.\r\n"},"comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments/339829771","html_url":"https://github.com/matplotlib/matplotlib/issues/9580#issuecomment-339829771","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/9580","id":339829771,"user":{"login":"jklymak","id":1562854,"avatar_url":"https://avatars0.githubusercontent.com/u/1562854?v=4","gravatar_id":"","url":"https://api.github.com/users/jklymak","html_url":"https://github.com/jklymak","followers_url":"https://api.github.com/users/jklymak/followers","following_url":"https://api.github.com/users/jklymak/following{/other_user}","gists_url":"https://api.github.com/users/jklymak/gists{/gist_id}","starred_url":"https://api.github.com/users/jklymak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jklymak/subscriptions","organizations_url":"https://api.github.com/users/jklymak/orgs","repos_url":"https://api.github.com/users/jklymak/repos","events_url":"https://api.github.com/users/jklymak/events{/privacy}","received_events_url":"https://api.github.com/users/jklymak/received_events","type":"User","site_admin":false},"created_at":"2017-10-26T23:30:33Z","updated_at":"2017-10-26T23:30:33Z","author_association":"CONTRIBUTOR","body":"I think there is a `contains_points` method in path?  Could you just check the four vertices of the legend?  "}}
{"actor":{"display_login":"jklymak"}}