{"action":"created","issue":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6166","repository_url":"https://api.github.com/repos/matplotlib/matplotlib","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6166/labels{/name}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6166/comments","events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6166/events","html_url":"https://github.com/matplotlib/matplotlib/issues/6166","id":141377504,"number":6166,"title":"legends do not refresh","user":{"login":"emdete","id":3251523,"avatar_url":"https://avatars.githubusercontent.com/u/3251523?v=3","gravatar_id":"","url":"https://api.github.com/users/emdete","html_url":"https://github.com/emdete","followers_url":"https://api.github.com/users/emdete/followers","following_url":"https://api.github.com/users/emdete/following{/other_user}","gists_url":"https://api.github.com/users/emdete/gists{/gist_id}","starred_url":"https://api.github.com/users/emdete/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emdete/subscriptions","organizations_url":"https://api.github.com/users/emdete/orgs","repos_url":"https://api.github.com/users/emdete/repos","events_url":"https://api.github.com/users/emdete/events{/privacy}","received_events_url":"https://api.github.com/users/emdete/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/matplotlib/matplotlib/labels/Animation","name":"Animation","color":"006b75"},{"url":"https://api.github.com/repos/matplotlib/matplotlib/labels/needs%20clarification","name":"needs clarification","color":"DDDDDD"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/15","html_url":"https://github.com/matplotlib/matplotlib/milestones/unassigned","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/15/labels","id":719140,"number":15,"title":"unassigned","description":null,"creator":{"login":"tacaswell","id":199813,"avatar_url":"https://avatars.githubusercontent.com/u/199813?v=3","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":120,"closed_issues":88,"state":"open","created_at":"2014-07-12T20:04:20Z","updated_at":"2016-03-17T21:25:53Z","due_on":null,"closed_at":null},"comments":10,"created_at":"2016-03-16T19:29:22Z","updated_at":"2016-03-18T13:44:58Z","closed_at":"2016-03-17T21:25:53Z","body":"- [ ]  matplotlib                       1.5.1\r\n- [ ]  python2.7                               2.7.11\r\n- [ ] running on Linux\r\n- [ ] installed via Debian package\r\n- [ ] i will check if i can create a sample showing the issue\r\n- [ ] it's an animation, so no screenshot, a screencapturevideo could be attached (a video writer does not work, it doesnt show the legend at all)\r\n- [ ]  i just start learning Matplotlib so i assume it's not a regression\r\n\r\ni created an animation that shows a live result-code distribution parsed from logfiles. my frames function reads a logfile (`tail -f` like), parses each line for the resultcode and returns just the resultcode. the animate function increments a counter for that code from which stacked bars are drawn.\r\n\r\nthe result-codes are unknown at startup so the animate function \"invents\" new bars on the fly with new labels. the legend is created in the init_func (and complains that there are no labels in my plots - it does not know they show up later). \r\n\r\nthe legend shows only one label - the first one that was added. this does not change when the program runs for a while until i resize the window. in that moment the correct number of labels will be shown. is this a bug or do i have to issue some 'refresh()' method to wake up the legend?"},"comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments/198366877","html_url":"https://github.com/matplotlib/matplotlib/issues/6166#issuecomment-198366877","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6166","id":198366877,"user":{"login":"WeatherGod","id":291576,"avatar_url":"https://avatars.githubusercontent.com/u/291576?v=3","gravatar_id":"","url":"https://api.github.com/users/WeatherGod","html_url":"https://github.com/WeatherGod","followers_url":"https://api.github.com/users/WeatherGod/followers","following_url":"https://api.github.com/users/WeatherGod/following{/other_user}","gists_url":"https://api.github.com/users/WeatherGod/gists{/gist_id}","starred_url":"https://api.github.com/users/WeatherGod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WeatherGod/subscriptions","organizations_url":"https://api.github.com/users/WeatherGod/orgs","repos_url":"https://api.github.com/users/WeatherGod/repos","events_url":"https://api.github.com/users/WeatherGod/events{/privacy}","received_events_url":"https://api.github.com/users/WeatherGod/received_events","type":"User","site_admin":false},"created_at":"2016-03-18T13:44:58Z","updated_at":"2016-03-18T13:44:58Z","body":"Here is my explanation about pyplot vs. axes methods:\nhttp://nbviewer.jupyter.org/github/WeatherGod/AnatomyOfMatplotlib/blob/master/AnatomyOfMatplotlib-Part1-Figures_Subplots_and_layouts.ipynb#Axes-methods-vs.-pyplot\n\ntl;dr;\n\nMatplotlib has its roots in interactive plotting via a REPL a la MatLab.\nSo, having concise, implicit semantics is what it started off with. As it\ngrew beyond those initial design goals, the OO-interface came about and it\nmakes everything explicit and unambiguous at the expense of conciseness.\n\n\nOn Fri, Mar 18, 2016 at 4:23 AM, M. Dietrich <notifications@github.com>\nwrote:\n\n> yes, i was wondering why matplotlib was so non-py and non-oo. i found the\n> first method in most of the samples while i found the second on some\n> stackoverflow-snippets. i was wondering that the second works (saw it only\n> in a multi-plot) and what the benefit is because it's so seldom in the\n> samples.\n>\n> —\n> You are receiving this because you are subscribed to this thread.\n> Reply to this email directly or view it on GitHub\n> <https://github.com/matplotlib/matplotlib/issues/6166#issuecomment-198249022>\n>\n"}}