You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-16Lines changed: 24 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,41 +18,49 @@ Or install the latest development version (on GitHub) via devtools:
18
18
devtools::install_github("ropensci/plotly")
19
19
```
20
20
21
-
## Introduction
21
+
## Getting Started
22
22
23
-
If you use [ggplot2](http://cran.r-project.org/package=ggplot2), use `ggplotly()` to convert your ggplot to an interactive, web-based version!
23
+
### ggplot2 converter
24
+
25
+
If you use [ggplot2](http://cran.r-project.org/package=ggplot2), `ggplotly()` converts your plots to an interactive, web-based version! It also provides sensible tooltips, which can help us decode values encoded as visual properties in the plot.
If you'd like to see how `ggplotly()` does in converting different ggplot2 examples, we host a [plotly version](http://ropensci.github.io/plotly/) of the [official ggplot2 documentation](http://docs.ggplot2.org).
36
38
37
-
[Click here](https://plot.ly/~agvd/1153) to interact with the resulting graph (notice the custom hover text!)
39
+
### plotly's custom R interface
38
40
39
-
__plotly__also supports certain chart types that ggplot2 doesn't support (such as 3D [surface](https://plot.ly/r/3d-surface-plots/), [point](https://plot.ly/r/3d-scatter-plots/), and [line](https://plot.ly/r/3d-line-plots/) plots). You can easily create these (or any other plotly) charts using the high-level interface.
41
+
__plotly__ supports some chart types that ggplot2 doesn't (such as 3D [surface](https://plot.ly/r/3d-surface-plots/), [point](https://plot.ly/r/3d-scatter-plots/), and [line](https://plot.ly/r/3d-line-plots/) plots). You can create these (or any other plotly) charts using the high-level interface.
The `ggplotly()` function converts a ggplot object to a plotly object, so if you like, you may 'post-process' your ggplot graphs to add custom plotly features, for example:
49
+
For a more detailed overview of this interface, see [here](https://cran.r-project.org/web/packages/plotly/vignettes/intro.html)
48
50
49
-
```r
50
-
layout(gg, hovermode="closest")
51
-
```
51
+
### Hooking onto plotly events
52
+
53
+
[plotly.js](https://github.com/plotly/plotly.js) exposes a number of 'standard' events that work consistently across plot types. It's easy to hook into these events using the `event_data()` function in shiny apps, as these examples demonstrate:
You can also hook into these events without shiny using `htmlwidgets::onRender()` ([example](https://github.com/ropensci/plotly/tree/master/inst/examples/onRenderHover)). This, however, requires JavaScript knowledge and makes it much harder, if not impossible, to coordinate views between htmlwidgets.
52
61
53
62
## Documentation
54
63
55
-
*[An introduction to plotly's R API](https://cran.r-project.org/web/packages/plotly/vignettes/intro.html)
56
64
* Examples and vignettes on plotly's R homepage - <https://plot.ly/r>
57
65
* The complete figure reference guide - <https://plot.ly/r/reference>
0 commit comments