{"action":"created","issue":{"url":"https://api.github.com/repos/rstudio/leaflet/issues/215","repository_url":"https://api.github.com/repos/rstudio/leaflet","labels_url":"https://api.github.com/repos/rstudio/leaflet/issues/215/labels{/name}","comments_url":"https://api.github.com/repos/rstudio/leaflet/issues/215/comments","events_url":"https://api.github.com/repos/rstudio/leaflet/issues/215/events","html_url":"https://github.com/rstudio/leaflet/issues/215","id":120553305,"number":215,"title":"enhancement - Legend as part of layer \"group\"?","user":{"login":"smartinsightsfromdata","id":3786727,"avatar_url":"https://avatars.githubusercontent.com/u/3786727?v=3","gravatar_id":"","url":"https://api.github.com/users/smartinsightsfromdata","html_url":"https://github.com/smartinsightsfromdata","followers_url":"https://api.github.com/users/smartinsightsfromdata/followers","following_url":"https://api.github.com/users/smartinsightsfromdata/following{/other_user}","gists_url":"https://api.github.com/users/smartinsightsfromdata/gists{/gist_id}","starred_url":"https://api.github.com/users/smartinsightsfromdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smartinsightsfromdata/subscriptions","organizations_url":"https://api.github.com/users/smartinsightsfromdata/orgs","repos_url":"https://api.github.com/users/smartinsightsfromdata/repos","events_url":"https://api.github.com/users/smartinsightsfromdata/events{/privacy}","received_events_url":"https://api.github.com/users/smartinsightsfromdata/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-05T13:06:37Z","updated_at":"2016-02-27T16:15:50Z","closed_at":"2016-02-27T16:15:50Z","body":"I am delighted by the possibility to select at runtime the layers to display using `addLayersControl`.\r\n\r\nOn the other hand, if I select to remove the choropleth, I am left with the legend, when the legend does not make much sense (having just removed the object the legend is referring to).\r\n\r\nI think there should be one of the two implementations:\r\n\r\n- if I remove the addPolygon layer the Legend that goes with it should disappear as well; or\r\n- I should be able to add the Legend as a `group` in  `addLayersControl` and to be able to remove at will.\r\n"},"comment":{"url":"https://api.github.com/repos/rstudio/leaflet/issues/comments/189675861","html_url":"https://github.com/rstudio/leaflet/issues/215#issuecomment-189675861","issue_url":"https://api.github.com/repos/rstudio/leaflet/issues/215","id":189675861,"user":{"login":"smartinsightsfromdata","id":3786727,"avatar_url":"https://avatars.githubusercontent.com/u/3786727?v=3","gravatar_id":"","url":"https://api.github.com/users/smartinsightsfromdata","html_url":"https://github.com/smartinsightsfromdata","followers_url":"https://api.github.com/users/smartinsightsfromdata/followers","following_url":"https://api.github.com/users/smartinsightsfromdata/following{/other_user}","gists_url":"https://api.github.com/users/smartinsightsfromdata/gists{/gist_id}","starred_url":"https://api.github.com/users/smartinsightsfromdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smartinsightsfromdata/subscriptions","organizations_url":"https://api.github.com/users/smartinsightsfromdata/orgs","repos_url":"https://api.github.com/users/smartinsightsfromdata/repos","events_url":"https://api.github.com/users/smartinsightsfromdata/events{/privacy}","received_events_url":"https://api.github.com/users/smartinsightsfromdata/received_events","type":"User","site_admin":false},"created_at":"2016-02-27T16:15:50Z","updated_at":"2016-02-27T16:15:50Z","body":":+1:   :+1:   :+1:   :+1: "}}