Skip to content

Commit

Permalink
Merge pull request #628 from ropensci/fix/nse
Browse files Browse the repository at this point in the history
Major update to `plot_ly()`
  • Loading branch information
cpsievert authored Jul 13, 2016
2 parents d2e5adf + 63e0ddb commit d2bf2a1
Show file tree
Hide file tree
Showing 112 changed files with 3,557 additions and 1,558 deletions.
14 changes: 9 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: plotly
Title: Create Interactive Web Graphics via 'plotly.js'
Version: 3.6.5
Version: 4.0.0
Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"),
email = "[email protected]"),
person("Chris", "Parmer", role = c("aut", "cph"),
Expand All @@ -20,20 +20,22 @@ Description: Easily translate 'ggplot2' graphs to an interactive web-based versi
URL: https://plot.ly/r, https://github.com/ropensci/plotly
BugReports: https://github.com/ropensci/plotly/issues
Depends:
R (>= 2.10),
ggplot2 (>= 2.1.0)
Imports:
scales,
httr,
jsonlite,
magrittr,
digest,
viridis,
viridisLite,
base64enc,
htmlwidgets,
tidyr,
hexbin
Suggests:
dplyr,
hexbin,
lazyeval (>= 0.2.0)
Suggests:
maps,
ggthemes,
GGally,
Expand All @@ -47,7 +49,9 @@ Suggests:
RColorBrewer,
Rserve,
RSclient,
broom
broom,
webshot,
listviewer
LazyData: true
VignetteBuilder: knitr
RoxygenNote: 5.0.1
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2014
COPYRIGHT HOLDER: Chris Parmer
YEAR: 2016
COPYRIGHT HOLDER: Chris Parmer
112 changes: 100 additions & 12 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ S3method(geom2trace,GeomTile)
S3method(geom2trace,default)
S3method(ggplotly,ggmatrix)
S3method(ggplotly,ggplot)
S3method(plotly_build,default)
S3method(layout,matrix)
S3method(layout,plotly)
S3method(plotly_build,gg)
S3method(plotly_build,plotly_built)
S3method(plotly_build,plotly_hash)
S3method(plotly_build,plotly_subplot)
S3method(print,figure)
S3method(print,plotly_built)
S3method(print,plotly_hash)
S3method(plotly_build,list)
S3method(plotly_build,plotly)
S3method(print,plotly_figure)
S3method(to_basic,GeomAbline)
S3method(to_basic,GeomArea)
S3method(to_basic,GeomBoxplot)
Expand All @@ -47,20 +45,57 @@ S3method(to_basic,GeomViolin)
S3method(to_basic,GeomVline)
S3method(to_basic,default)
export("%>%")
export(add_area)
export(add_bars)
export(add_boxplot)
export(add_choropleth)
export(add_contour)
export(add_data)
export(add_heatmap)
export(add_histogram)
export(add_histogram2d)
export(add_histogram2dcontour)
export(add_lines)
export(add_markers)
export(add_paths)
export(add_polygons)
export(add_ribbons)
export(add_scattergeo)
export(add_segments)
export(add_surface)
export(add_text)
export(add_trace)
export(arrange)
export(arrange_)
export(arrange_.plotly)
export(as.widget)
export(config)
export(distinct)
export(distinct_)
export(distinct_.plotly)
export(do)
export(do_)
export(embed_notebook)
export(event_data)
export(export)
export(filter)
export(filter_)
export(filter_.plotly)
export(geom2trace)
export(get_figure)
export(gg2list)
export(ggplotly)
export(knit_print.figure)
export(knit_print.plotly_built)
export(knit_print.plotly_hash)
export(last_plot)
export(group_by)
export(group_by_)
export(group_by_.plotly)
export(groups)
export(groups.plotly)
export(hide_colorbar)
export(knit_print.plotly_figure)
export(layout)
export(mutate)
export(mutate_)
export(mutate_.plotly)
export(offline)
export(plot_ly)
export(plotly)
Expand All @@ -69,16 +104,62 @@ export(plotly_IMAGE)
export(plotly_POST)
export(plotly_build)
export(plotly_empty)
export(plotly_json)
export(rename)
export(rename_)
export(rename_.plotly)
export(renderPlotly)
export(schema)
export(select)
export(select_)
export(select_.plotly)
export(signup)
export(slice)
export(slice_)
export(slice_.plotly)
export(style)
export(subplot)
export(summarise)
export(summarise_)
export(summarise_.plotly)
export(toRGB)
export(toWebGL)
export(to_basic)
export(transmute)
export(transmute_)
export(transmute_.plotly)
export(ungroup)
export(ungroup.plotly)
import(ggplot2)
importFrom(base64enc,base64encode)
importFrom(dplyr,arrange)
importFrom(dplyr,arrange_)
importFrom(dplyr,distinct)
importFrom(dplyr,distinct_)
importFrom(dplyr,do)
importFrom(dplyr,do_)
importFrom(dplyr,filter)
importFrom(dplyr,filter_)
importFrom(dplyr,group_by)
importFrom(dplyr,group_by_)
importFrom(dplyr,groups)
importFrom(dplyr,mutate)
importFrom(dplyr,mutate_)
importFrom(dplyr,rename)
importFrom(dplyr,rename_)
importFrom(dplyr,select)
importFrom(dplyr,select_)
importFrom(dplyr,slice)
importFrom(dplyr,slice_)
importFrom(dplyr,summarise)
importFrom(dplyr,summarise_)
importFrom(dplyr,transmute)
importFrom(dplyr,transmute_)
importFrom(dplyr,ungroup)
importFrom(grDevices,col2rgb)
importFrom(graphics,layout)
importFrom(htmlwidgets,createWidget)
importFrom(htmlwidgets,saveWidget)
importFrom(htmlwidgets,shinyRenderWidget)
importFrom(htmlwidgets,shinyWidgetOutput)
importFrom(htmlwidgets,sizingPolicy)
Expand All @@ -91,13 +172,20 @@ importFrom(httr,content)
importFrom(httr,stop_for_status)
importFrom(jsonlite,fromJSON)
importFrom(jsonlite,toJSON)
importFrom(lazyeval,all_dots)
importFrom(lazyeval,f_eval)
importFrom(lazyeval,is_formula)
importFrom(lazyeval,is_lang)
importFrom(magrittr,"%>%")
importFrom(stats,complete.cases)
importFrom(stats,quantile)
importFrom(stats,setNames)
importFrom(tidyr,gather)
importFrom(tidyr,gather_)
importFrom(tidyr,unnest)
importFrom(utils,browseURL)
importFrom(utils,data)
importFrom(utils,getFromNamespace)
importFrom(utils,modifyList)
importFrom(utils,packageVersion)
importFrom(viridis,viridis)
importFrom(viridisLite,viridis)
32 changes: 31 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
3.6.4 -- 31 May 2016
4.0.0

BREAKING CHANGES & IMPROVEMENTS:

* Formulas (instead of plain expressions) are now required when using variable mappings. For example, `plot_ly(mtcars, x = wt, y = mpg, color = vs)` should now be `plot_ly(mtcars, x = ~wt, y = ~mpg, color = ~vs)`. This is a major breaking change, but it is necessary to ensure that evaluation is correct in all contexts (as a result, `evaluate` argument is now deprecated as it is no longer needed). It also has the benefit of being easier to program with (i.e., writing your own custom functions that wrap `plot_ly()`). For more details, see the [lazyeval vignette](https://github.com/hadley/lazyeval/blob/master/vignettes/lazyeval.Rmd)
* The data structure used to represent plotly objects is now an htmlwidget object (instead of a data frame with a special attribute tracking visual mappings). As a result, the `as.widget()` function has been deprecated, and [serialization/memory leak problems](https://github.com/rstudio/shiny/issues/1151) are no longer an issue. This change also implies that arbitrary data manipulation functions can no longer be intermingled inside a plot pipeline, but plotly methods for dplyr's data manipulation verbs are now provided (see `?plotly_data` for examples).
* The `group` variable mapping no longer create multiple traces, but instead defines "gaps" within a trace (fixes #418, #381, #577). Groupings should be declared via the new `group_by()` function (see `help(plotly_data)` for examples) instead of the `group` argument (which is now deprecated).
* `plot_ly()` now _initializes_ a plotly object (i.e., won't add a scatter trace by default), meaning that something like `plot_ly(x = 1:10, y = 1:10) %>% add_trace(y = 10:1)` creates one trace, instead of two. That being said, if you manually specify a trace type in `plot_ly()`, it will add a layer with that trace type (e.g. `plot_ly(x = 1:10, y = 1:10, type = "scatter") %>% add_trace(y = 10:1)` draws two scatter traces). If no trace type is provided, a sensible type is inferred from the supplied data, and automatically added (i.e., `plot_ly(x = rnorm(100))` now creates a histogram).
* The `inherit` argument is deprecated. Any arguments/attributes specified in `plot_ly()` will automatically be passed along to additional traces added via `add_trace()` (or any of it's `add_*()` siblings).
* Aesthetic scaling (e.g., `color`, `symbol`, `size`) is applied at the plot-level, instead of the trace level.

NEW FEATURES & IMPROVEMENTS:

* Added `linetype`/`linetypes` arguments for mapping discrete variables to line types (works very much like the `symbol`/`symbols`).
* Scaling for aesthetics can be avoided via `I()` (closes #428). This is mainly useful for changing default appearance (e.g. `plot_ly(x = 1:10, y = 1:10, color = I(rainbow(10)))`).
* Symbols and linetypes now recognize `pch` and `lty` values (e.g. `plot_ly(x = 1:25, y = 1:25, symbol = I(0:24))`)
* A new `alpha` argument controls the alpha transparency of `color` (e.g. `plot_ly(x = 1:10, y = 1:10, color = I("red"), alpha = 0.1)`).
* Added a `sizes` argument for controlling the range of marker size scaling.
* New `add_polygons()`/`add_ribbons()`/`add_area()`/`add_segments()`/`add_lines()`/`add_markers()`/`add_paths()`/`add_text()` functions provide a shorthand for common special cases of `add_trace()`.
* New `toWebGL()` function for easy conversion from SVG to WebGL.
* New `export()` function makes it easy to save plots as png/jpeg/pdf (fixes #311).
* Misspecified trace/layout attributes produce a warning.
* New `plotly_data()` function for returning/inspecting data frame(s) associated with a plotly object.
* New `plotly_json()` function for inspecting the data sent to plotly.js (as an R list or JSON).
* `layout()` is now a generic function and uses method dispatch to avoid conflicts with `graphics:layout()` (fixes #464).

OTHER CHANGES:

* Upgraded to plotly.js v1.14.1 -- https://github.com/plotly/plotly.js/releases/tag/v1.14.1

3.6.5 -- 10 June 2016

IMPROVEMENT:

Expand Down
Loading

0 comments on commit d2bf2a1

Please sign in to comment.