- Notifications
You must be signed in to change notification settings - Fork633
ggplotly design, internals, technical stuff
Carson edited this pageAug 1, 2015 ·7 revisions
In ggplot2 the group aesthetic is used to designate separate lines, polygons, paths, ribbons (but not points) that all look the same. For example in thecanada cities viz the borders are a geom_polygon with aes(group).
> borders(regions="canada",name="borders")mapping:x=long,y=lat,group=groupgeom_polygon:colour=grey50,fill=NAstat_identity:name=bordersposition_identity: (width=NULL,height=NULL)
It is important that this is translated as 1 trace with NAs (not a separate trace for each lake/island), because
- it is much more efficient (the plotly web site is slow when there are many traces to render).
- each trace gets its own legend entry and it doesn't make sense to have separate legend entries for each one of the lakes/islands/etc.
A test for this functionality ishere
ggplot2 legends are more sophisticated than plotly legends, so it is impossible to translate everything. In particular there may be several legends in ggplot2 (color, linetype, etc) but only 1 in plotly. Plotly takes the legend labels from the names of the traces.
Earn upto $500 loginhttps://evil.com