Skip to content

Major update to plot_ly() #628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 75 commits into from
Jul 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
f30c06d
rethink evaluation and plotly object representation model
cpsievert May 26, 2016
c1c0ec9
make group2NA simpler and reusable
cpsievert May 26, 2016
d9c479d
fixes for style(), group2NA(), import dplyr
cpsievert May 27, 2016
ba0aa50
dplyrify group2NA (now much, much faster)
cpsievert May 27, 2016
6bce1b8
first implementation of dplyr methods (thanks ggvis)
cpsievert May 27, 2016
9409c14
ggplotly should return information about the data so it works with do…
cpsievert May 27, 2016
3d10149
deprecate group argument in favor of group_by()
cpsievert May 31, 2016
becb122
always inherit arguments from plot_ly()
cpsievert Jun 1, 2016
bb83979
error checking for trace attributes
cpsievert Jun 1, 2016
7300e8d
unlink file when updating plotlyjs attrs
cpsievert Jun 9, 2016
f8729c1
merge conflicts
cpsievert Jun 9, 2016
5a4b314
fix NEWS version
cpsievert Jun 9, 2016
578bb2a
modify tests to reflect backwards-incompatible changes
cpsievert Jun 10, 2016
b546d10
if trace type is missing in add_*(), inherit from first trace
cpsievert Jun 10, 2016
03da3d4
use viridisLite; start thinking about 'transforms'
cpsievert Jun 10, 2016
94a8797
update intro vignette
cpsievert Jun 10, 2016
627ead9
aesthetic mappings should be plot (not trace) specific; add linetype/…
cpsievert Jun 15, 2016
3a9ae7a
fix trace layering logic; avoid hard-coding data_array boxing logic
cpsievert Jun 15, 2016
bdc27d1
Use rapply to evaluate formulas of arbitrary depth
cpsievert Jun 16, 2016
7688a57
export group_by
cpsievert Jun 16, 2016
ed1e4fc
various bug fixes; updates to docs/tests
cpsievert Jun 16, 2016
5e3f011
more documentation
cpsievert Jun 16, 2016
f94645c
trace type inference
cpsievert Jun 17, 2016
ea7e097
better docs; plotly_spec -> plotly_json; bug fixes
cpsievert Jun 17, 2016
c002991
fix layout bug identified by @timelyportfolio
cpsievert Jun 17, 2016
dc2669b
for consistency in naming; add_points -> add_markers
cpsievert Jun 17, 2016
823e1ba
implement size/sizes; fix symbols; better docs
cpsievert Jun 17, 2016
b4d482d
fix NAMESPACE
cpsievert Jun 17, 2016
f201bcc
remove redundant R/dplyr.R
cpsievert Jun 20, 2016
653a584
fix grouping within multiple traces; fix axis titles; fix hovermode d…
cpsievert Jun 20, 2016
2d3f368
fix has_attr
cpsievert Jun 20, 2016
ec48625
fix uniq
cpsievert Jun 20, 2016
3d618ba
improve group2NA; fix zcolor bugs; improve tests
cpsievert Jun 20, 2016
7eafaa7
update subplot vignette; safer data referencing
cpsievert Jun 20, 2016
a63ff71
import/namespace updates
cpsievert Jun 20, 2016
d23ff3c
travis tests no longer need envir hacks
cpsievert Jun 20, 2016
d025989
fixes for plotly figures; don't document group2NA
cpsievert Jun 20, 2016
b12f507
fix problems identified by R CMD check
cpsievert Jun 20, 2016
d724e59
let the travis fun begin
cpsievert Jun 20, 2016
2578156
get add_polygon working
cpsievert Jun 20, 2016
445b9af
get add_lines() working
cpsievert Jun 20, 2016
6410831
maybe caching is the problem
cpsievert Jun 21, 2016
a5600a7
GGally
cpsievert Jun 21, 2016
57a9b71
are we having fun yet?
cpsievert Jun 21, 2016
254422c
I give up
cpsievert Jun 21, 2016
d6aeeec
more transform/group fixes; deparsed axis titles should only be set w…
cpsievert Jun 21, 2016
6a59af2
fix some special cases in color mapping
cpsievert Jun 21, 2016
14abd2a
make hide_colorbar more universal; don't require formulas for variabl…
cpsievert Jun 21, 2016
c48c5ae
better 3d/z color mapping
cpsievert Jun 21, 2016
09a03d4
go back to caching
cpsievert Jun 21, 2016
066b12d
get add_area()/add_ribbon() working; place all add_*() functions on ?…
cpsievert Jun 22, 2016
22d180a
fix NAMESPACING
cpsievert Jun 22, 2016
0ed2271
you have to pass the arguments through silly
cpsievert Jun 22, 2016
7a1254e
add add_segments()
cpsievert Jun 22, 2016
86c41f7
improve toWebGl implementation; safer group var naming
cpsievert Jun 22, 2016
abc39dd
deprecate as.widget
cpsievert Jun 22, 2016
268d5c4
update NEWS; better deparsing
cpsievert Jun 22, 2016
456d186
add event source; fixes event_data() on plotly graphs
cpsievert Jun 22, 2016
b2b9bd7
fix config()
cpsievert Jun 22, 2016
04dde5d
update inst/examples
cpsievert Jun 22, 2016
132b9cd
vapply is too strict
cpsievert Jun 22, 2016
3335d39
documentation fixes
cpsievert Jun 22, 2016
fd2d9d5
some grouping/ordering fixes
cpsievert Jun 23, 2016
0e744dc
add_heatmap
cpsievert Jun 23, 2016
a807ad4
add a few more basic add_*() functions
cpsievert Jun 23, 2016
1359a14
moar add_*()
cpsievert Jun 23, 2016
e967669
symbol/linetype fixes
cpsievert Jun 24, 2016
ced729f
fix return value of lmgadget
cpsievert Jun 24, 2016
b16f8b7
better plotly_data() examples; use @rawNamespace to avoid unwanted S3…
cpsievert Jun 26, 2016
522224c
export filter
cpsievert Jun 28, 2016
3e3e881
a few half-baked ideas for fill/stroke/alpha shortcuts
cpsievert Jun 29, 2016
77d47ed
upgrade to plotlyjs 1.14.1
cpsievert Jul 6, 2016
d705371
provide scaling escape hatch via I(); add alpha argument; get missing…
cpsievert Jul 13, 2016
1bd9d6a
fix bad example
cpsievert Jul 13, 2016
63e0ddb
curse you cbind
cpsievert Jul 13, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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