{"action":"created","issue":{"url":"https://api.github.com/repos/ropensci/plotly/issues/168","labels_url":"https://api.github.com/repos/ropensci/plotly/issues/168/labels{/name}","comments_url":"https://api.github.com/repos/ropensci/plotly/issues/168/comments","events_url":"https://api.github.com/repos/ropensci/plotly/issues/168/events","html_url":"https://github.com/ropensci/plotly/issues/168","id":58647248,"number":168,"title":"Legend combining fill.name and group.name when ggplot keeps fill.name only","user":{"login":"mkcor","id":2227806,"avatar_url":"https://avatars.githubusercontent.com/u/2227806?v=3","gravatar_id":"","url":"https://api.github.com/users/mkcor","html_url":"https://github.com/mkcor","followers_url":"https://api.github.com/users/mkcor/followers","following_url":"https://api.github.com/users/mkcor/following{/other_user}","gists_url":"https://api.github.com/users/mkcor/gists{/gist_id}","starred_url":"https://api.github.com/users/mkcor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkcor/subscriptions","organizations_url":"https://api.github.com/users/mkcor/orgs","repos_url":"https://api.github.com/users/mkcor/repos","events_url":"https://api.github.com/users/mkcor/events{/privacy}","received_events_url":"https://api.github.com/users/mkcor/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-02-23T21:01:31Z","updated_at":"2015-03-27T17:30:22Z","closed_at":"2015-03-27T03:02:09Z","body":"@jcp1016 reported a very interesting issue which occurs when converting this awesome map:\r\n![nyc_collisions](https://cloud.githubusercontent.com/assets/2227806/6336697/769a5e40-bb72-11e4-820c-d86a95e112fe.png)\r\n\r\nThe ggplot code being\r\n```r\r\nggplot(map_df) + \r\n        aes(long, lat, fill=CollisionRange, group=group) + \r\n        geom_polygon() + \r\n        geom_path(color=\"white\", linetype=1, size=0.25) + \r\n        ggtitle(\"Collisions Reported in New York City - 2014\") + \r\n        xlab(NULL) + ylab(NULL) + coord_equal() + \r\n        scale_fill_brewer() + \r\n        theme(axis.ticks = element_blank(), \r\n              axis.text.x = element_blank(), \r\n              axis.text.y = element_blank(), \r\n              legend.title=element_blank())\r\n```\r\nThe entire project can be found at https://github.com/jcp1016/Collisions (code lives in \"Main.Rmd\").\r\n\r\nShe cites https://github.com/hadley/ggplot2/wiki/plotting-polygon-shapefiles for the choice of aesthetics and using geom_polygon.\r\n\r\nAs is, the ggplotly conversion (https://plot.ly/~marianne2/824/collisions-reported-in-new-york-city-2014/) looks good for the plot itself, but the legend is wrong: it's a cross product of `fill.name` and `group.name`, where the ggplot only represents `fill.name` in the legend...\r\n\r\n@chriddyp @tdhock @cpsievert I would love your ideas on how to approach this. I definitely don't want to hack something that would make the legend work just in this case. I think it makes sense to include `group.name` in the legend *in general*. Would we want to give up on 'recreating' legends *logically* and, instead, retrieve the ggplot legends and translate them 'directly'?\r\n\r\nFor your information, showing below the resulting ggplot without `group` aesthetic argument:\r\n![missing_group](https://cloud.githubusercontent.com/assets/2227806/6337043/1d1f8752-bb75-11e4-8cf3-fd9f5f7a7fa2.png)"},"comment":{"url":"https://api.github.com/repos/ropensci/plotly/issues/comments/87023361","html_url":"https://github.com/ropensci/plotly/issues/168#issuecomment-87023361","issue_url":"https://api.github.com/repos/ropensci/plotly/issues/168","id":87023361,"user":{"login":"jcp1016","id":1551416,"avatar_url":"https://avatars.githubusercontent.com/u/1551416?v=3","gravatar_id":"","url":"https://api.github.com/users/jcp1016","html_url":"https://github.com/jcp1016","followers_url":"https://api.github.com/users/jcp1016/followers","following_url":"https://api.github.com/users/jcp1016/following{/other_user}","gists_url":"https://api.github.com/users/jcp1016/gists{/gist_id}","starred_url":"https://api.github.com/users/jcp1016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcp1016/subscriptions","organizations_url":"https://api.github.com/users/jcp1016/orgs","repos_url":"https://api.github.com/users/jcp1016/repos","events_url":"https://api.github.com/users/jcp1016/events{/privacy}","received_events_url":"https://api.github.com/users/jcp1016/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T17:30:22Z","updated_at":"2015-03-27T17:30:22Z","body":"Great news, thanks very much!\r\n\r\nJanet"}}