Skip to content

Commit d2bf2a1

Browse files
authored
Merge pull request #628 from ropensci/fix/nse
Major update to `plot_ly()`
2 parents d2e5adf + 63e0ddb commit d2bf2a1

File tree

112 files changed

+3557
-1558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+3557
-1558
lines changed

DESCRIPTION

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: plotly
22
Title: Create Interactive Web Graphics via 'plotly.js'
3-
Version: 3.6.5
3+
Version: 4.0.0
44
Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"),
55
email = "[email protected]"),
66
person("Chris", "Parmer", role = c("aut", "cph"),
@@ -20,20 +20,22 @@ Description: Easily translate 'ggplot2' graphs to an interactive web-based versi
2020
URL: https://plot.ly/r, https://github.com/ropensci/plotly
2121
BugReports: https://github.com/ropensci/plotly/issues
2222
Depends:
23+
R (>= 2.10),
2324
ggplot2 (>= 2.1.0)
2425
Imports:
2526
scales,
2627
httr,
2728
jsonlite,
2829
magrittr,
2930
digest,
30-
viridis,
31+
viridisLite,
3132
base64enc,
3233
htmlwidgets,
3334
tidyr,
34-
hexbin
35-
Suggests:
3635
dplyr,
36+
hexbin,
37+
lazyeval (>= 0.2.0)
38+
Suggests:
3739
maps,
3840
ggthemes,
3941
GGally,
@@ -47,7 +49,9 @@ Suggests:
4749
RColorBrewer,
4850
Rserve,
4951
RSclient,
50-
broom
52+
broom,
53+
webshot,
54+
listviewer
5155
LazyData: true
5256
VignetteBuilder: knitr
5357
RoxygenNote: 5.0.1

LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
YEAR: 2014
2-
COPYRIGHT HOLDER: Chris Parmer
1+
YEAR: 2016
2+
COPYRIGHT HOLDER: Chris Parmer

NAMESPACE

+100-12
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ S3method(geom2trace,GeomTile)
1313
S3method(geom2trace,default)
1414
S3method(ggplotly,ggmatrix)
1515
S3method(ggplotly,ggplot)
16-
S3method(plotly_build,default)
16+
S3method(layout,matrix)
17+
S3method(layout,plotly)
1718
S3method(plotly_build,gg)
18-
S3method(plotly_build,plotly_built)
19-
S3method(plotly_build,plotly_hash)
20-
S3method(plotly_build,plotly_subplot)
21-
S3method(print,figure)
22-
S3method(print,plotly_built)
23-
S3method(print,plotly_hash)
19+
S3method(plotly_build,list)
20+
S3method(plotly_build,plotly)
21+
S3method(print,plotly_figure)
2422
S3method(to_basic,GeomAbline)
2523
S3method(to_basic,GeomArea)
2624
S3method(to_basic,GeomBoxplot)
@@ -47,20 +45,57 @@ S3method(to_basic,GeomViolin)
4745
S3method(to_basic,GeomVline)
4846
S3method(to_basic,default)
4947
export("%>%")
48+
export(add_area)
49+
export(add_bars)
50+
export(add_boxplot)
51+
export(add_choropleth)
52+
export(add_contour)
53+
export(add_data)
54+
export(add_heatmap)
55+
export(add_histogram)
56+
export(add_histogram2d)
57+
export(add_histogram2dcontour)
58+
export(add_lines)
59+
export(add_markers)
60+
export(add_paths)
61+
export(add_polygons)
62+
export(add_ribbons)
63+
export(add_scattergeo)
64+
export(add_segments)
65+
export(add_surface)
66+
export(add_text)
5067
export(add_trace)
68+
export(arrange)
69+
export(arrange_)
70+
export(arrange_.plotly)
5171
export(as.widget)
5272
export(config)
73+
export(distinct)
74+
export(distinct_)
75+
export(distinct_.plotly)
76+
export(do)
77+
export(do_)
5378
export(embed_notebook)
5479
export(event_data)
80+
export(export)
81+
export(filter)
82+
export(filter_)
83+
export(filter_.plotly)
5584
export(geom2trace)
5685
export(get_figure)
5786
export(gg2list)
5887
export(ggplotly)
59-
export(knit_print.figure)
60-
export(knit_print.plotly_built)
61-
export(knit_print.plotly_hash)
62-
export(last_plot)
88+
export(group_by)
89+
export(group_by_)
90+
export(group_by_.plotly)
91+
export(groups)
92+
export(groups.plotly)
93+
export(hide_colorbar)
94+
export(knit_print.plotly_figure)
6395
export(layout)
96+
export(mutate)
97+
export(mutate_)
98+
export(mutate_.plotly)
6499
export(offline)
65100
export(plot_ly)
66101
export(plotly)
@@ -69,16 +104,62 @@ export(plotly_IMAGE)
69104
export(plotly_POST)
70105
export(plotly_build)
71106
export(plotly_empty)
107+
export(plotly_json)
108+
export(rename)
109+
export(rename_)
110+
export(rename_.plotly)
72111
export(renderPlotly)
112+
export(schema)
113+
export(select)
114+
export(select_)
115+
export(select_.plotly)
73116
export(signup)
117+
export(slice)
118+
export(slice_)
119+
export(slice_.plotly)
74120
export(style)
75121
export(subplot)
122+
export(summarise)
123+
export(summarise_)
124+
export(summarise_.plotly)
76125
export(toRGB)
126+
export(toWebGL)
77127
export(to_basic)
128+
export(transmute)
129+
export(transmute_)
130+
export(transmute_.plotly)
131+
export(ungroup)
132+
export(ungroup.plotly)
78133
import(ggplot2)
79134
importFrom(base64enc,base64encode)
135+
importFrom(dplyr,arrange)
136+
importFrom(dplyr,arrange_)
137+
importFrom(dplyr,distinct)
138+
importFrom(dplyr,distinct_)
139+
importFrom(dplyr,do)
140+
importFrom(dplyr,do_)
141+
importFrom(dplyr,filter)
142+
importFrom(dplyr,filter_)
143+
importFrom(dplyr,group_by)
144+
importFrom(dplyr,group_by_)
145+
importFrom(dplyr,groups)
146+
importFrom(dplyr,mutate)
147+
importFrom(dplyr,mutate_)
148+
importFrom(dplyr,rename)
149+
importFrom(dplyr,rename_)
150+
importFrom(dplyr,select)
151+
importFrom(dplyr,select_)
152+
importFrom(dplyr,slice)
153+
importFrom(dplyr,slice_)
154+
importFrom(dplyr,summarise)
155+
importFrom(dplyr,summarise_)
156+
importFrom(dplyr,transmute)
157+
importFrom(dplyr,transmute_)
158+
importFrom(dplyr,ungroup)
80159
importFrom(grDevices,col2rgb)
160+
importFrom(graphics,layout)
81161
importFrom(htmlwidgets,createWidget)
162+
importFrom(htmlwidgets,saveWidget)
82163
importFrom(htmlwidgets,shinyRenderWidget)
83164
importFrom(htmlwidgets,shinyWidgetOutput)
84165
importFrom(htmlwidgets,sizingPolicy)
@@ -91,13 +172,20 @@ importFrom(httr,content)
91172
importFrom(httr,stop_for_status)
92173
importFrom(jsonlite,fromJSON)
93174
importFrom(jsonlite,toJSON)
175+
importFrom(lazyeval,all_dots)
176+
importFrom(lazyeval,f_eval)
177+
importFrom(lazyeval,is_formula)
178+
importFrom(lazyeval,is_lang)
94179
importFrom(magrittr,"%>%")
95180
importFrom(stats,complete.cases)
181+
importFrom(stats,quantile)
96182
importFrom(stats,setNames)
97183
importFrom(tidyr,gather)
184+
importFrom(tidyr,gather_)
185+
importFrom(tidyr,unnest)
98186
importFrom(utils,browseURL)
99187
importFrom(utils,data)
100188
importFrom(utils,getFromNamespace)
101189
importFrom(utils,modifyList)
102190
importFrom(utils,packageVersion)
103-
importFrom(viridis,viridis)
191+
importFrom(viridisLite,viridis)

NEWS

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,34 @@
1-
3.6.4 -- 31 May 2016
1+
4.0.0
2+
3+
BREAKING CHANGES & IMPROVEMENTS:
4+
5+
* 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)
6+
* 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).
7+
* 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).
8+
* `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).
9+
* 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).
10+
* Aesthetic scaling (e.g., `color`, `symbol`, `size`) is applied at the plot-level, instead of the trace level.
11+
12+
NEW FEATURES & IMPROVEMENTS:
13+
14+
* Added `linetype`/`linetypes` arguments for mapping discrete variables to line types (works very much like the `symbol`/`symbols`).
15+
* 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)))`).
16+
* Symbols and linetypes now recognize `pch` and `lty` values (e.g. `plot_ly(x = 1:25, y = 1:25, symbol = I(0:24))`)
17+
* 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)`).
18+
* Added a `sizes` argument for controlling the range of marker size scaling.
19+
* 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()`.
20+
* New `toWebGL()` function for easy conversion from SVG to WebGL.
21+
* New `export()` function makes it easy to save plots as png/jpeg/pdf (fixes #311).
22+
* Misspecified trace/layout attributes produce a warning.
23+
* New `plotly_data()` function for returning/inspecting data frame(s) associated with a plotly object.
24+
* New `plotly_json()` function for inspecting the data sent to plotly.js (as an R list or JSON).
25+
* `layout()` is now a generic function and uses method dispatch to avoid conflicts with `graphics:layout()` (fixes #464).
26+
27+
OTHER CHANGES:
28+
29+
* Upgraded to plotly.js v1.14.1 -- https://github.com/plotly/plotly.js/releases/tag/v1.14.1
30+
31+
3.6.5 -- 10 June 2016
232

333
IMPROVEMENT:
434

0 commit comments

Comments
 (0)