Skip to content

Commit 284c572

Browse files
committed
update readme
1 parent caa4175 commit 284c572

File tree

2 files changed

+11
-180
lines changed

2 files changed

+11
-180
lines changed

README.Rmd

Lines changed: 0 additions & 98 deletions
This file was deleted.

README.md

Lines changed: 11 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ control over the interactive behavior. The `ggplotly()` function itself
5252
has some convenient “high-level” arguments, such as `dynamicTicks`,
5353
which tells plotly.js to dynamically recompute axes, when appropriate.
5454
The `style()` function also comes in handy for *modifying* the
55-
underlying [traces
56-
attributes](https://plot.ly/r/reference/#scatter-hoveron) used to
57-
generate the plot:
55+
underlying trace
56+
attributes (e.g. [hoveron](https://plot.ly/r/reference/#scatter-hoveron)) used to generate the plot:
5857

5958
``` r
6059
gg <- ggplotly(g, dynamicTicks = "y")
@@ -66,20 +65,20 @@ style(gg, hoveron = "points", hoverinfo = "x+y+text", hoverlabel = list(bgcolor
6665
Moreover, since `ggplotly()` returns a plotly object, you can apply
6766
essentially any function from the R package on that object. Some useful
6867
ones include `layout()` (for [customizing the
69-
layout](https://cpsievert.github.io/plotly_book/extending-ggplotly.html#customizing-the-layout)),
68+
layout](https://plotly-r.com/improving-ggplotly.html#modifying-layout)),
7069
`add_traces()` (and its higher-level `add_*()` siblings, for example
7170
`add_polygons()`, for [adding new
72-
traces/data](https://cpsievert.github.io/plotly_book/extending-ggplotly.html#leveraging-statistical-output)),
71+
traces/data](https://plotly-r.com/improving-ggplotly.html#leveraging-statistical-output)),
7372
`subplot()` (for [combining multiple plotly
74-
objects](https://cpsievert.github.io/plotly_book/merging-plotly-objects.html)),
73+
objects](https://plotly-r.com/arranging-views.html#arranging-plotly-objects)),
7574
and `plotly_json()` (for inspecting the underlying JSON sent to
7675
plotly.js).
7776

7877
The `ggplotly()` function will also respect some “unofficial”
7978
**ggplot2** aesthetics, namely `text` (for [customizing the
80-
tooltip](https://cpsievert.github.io/plotly_book/a-case-study-of-housing-sales-in-texas.html#fig:ggsubplot)),
79+
tooltip](https://plotly-r.com/controlling-tooltips.html#tooltip-text-ggplotly)),
8180
`frame` (for [creating
82-
animations](https://cpsievert.github.io/plotly_book/key-frame-animations.html)),
81+
animations](https://plotly-r.com/animating-views.html)),
8382
and `ids` (for ensuring sensible smooth transitions).
8483

8584
### Using plotly without ggplot2
@@ -90,87 +89,17 @@ coordinates](https://plot.ly/r/parallel-coordinates-plot/) or
9089
[maps](https://plot.ly/r/maps/)) or even some visualization that the
9190
ggplot2 API won’t ever support (e.g., surface,
9291
[mesh](https://plot.ly/r/3d-mesh/),
93-
[trisurf](https://plot.ly/r/trisurf/), or sankey diagrams). The
94-
[cheatsheet](https://images.plot.ly/plotly-documentation/images/r_cheat_sheet.pdf)
95-
is a nice quick reference for this interface, but the [plotly
96-
cookbook](https://cpsievert.github.io/plotly_book/the-plotly-cookbook.html)
97-
has more complete overview of the philosophy behind this “non-ggplot2”
98-
approach.
92+
[trisurf](https://plot.ly/r/trisurf/), etc).
9993

10094
``` r
10195
plot_ly(z = ~volcano, type = "surface")
10296
```
10397

10498
![<https://plot.ly/~brnvg/1134>](https://plot.ly/~brnvg/1134.png)
10599

106-
## Crosstalk support
107-
108-
The R package has special support for linking/highlighting/filtering
109-
views that is not (yet) available outside of the R package. This
110-
functionality is built upon the [**crosstalk**
111-
package](https://rstudio.github.io/crosstalk/), which distinguishes
112-
between two event classes: *select* and *filter*. The **plotly** package
113-
interprets these classes in the following way:
114-
115-
1. **Select**: add new “selection” trace(s) (i.e., graphical marks) and
116-
*dim* the other traces. Some people refer to this as “brushing” or
117-
“highlighting”.
118-
2. **Filter**: retain “selection” trace(s), but *remove* other traces,
119-
and update the layout accordingly. Some people refer to this as
120-
“crossfilter” or “drill-down”.
121-
122-
The following gif helps to demonstrate the difference – see
123-
[here](http://rpubs.com/cpsievert/275511) for the code used to generate
124-
it.
125-
126-
![<http://rpubs.com/cpsievert/275511>](http://i.imgur.com/cYsuNQn.gif)
127-
128-
Like other [crosstalk enabled
129-
widgets](https://rstudio.github.io/crosstalk/widgets.html), **plotly**
130-
responds to filter events, but you can’t (yet) emit a filter event via
131-
direct manipulation of a plotly graph. Unlike (some) other crosstalk
132-
enabled widgets, **plotly** has advanced support for select (a much more
133-
broad class than filter) events, like [persistent/dynamic
134-
brushing](https://cpsievert.github.io/plotly_book/linking-views-without-shiny.html#transient-versus-persistent-selection),
135-
[brushing via indirect
136-
manipulation](https://cpsievert.github.io/plotly_book/linking-views-without-shiny.html#selection-via-indirect-manipulation),
137-
and even ways to [completely control the appearance new selection
138-
traces](https://cpsievert.github.io/plotcon17/workshop/day2/#21). In
139-
other words, these “special” brushing features work when linking
140-
multiple **plotly** graphs, but may not when linking to other crosstalk
141-
enabled widgets.
142-
143-
To date, [this slide
144-
deck](https://cpsievert.github.io/plotcon17/workshop/day2) is the most
145-
comprehensive, yet somewhat thorough, walk-through of this framework,
146-
but the [linking views without
147-
shiny](https://cpsievert.github.io/plotly_book/linking-views-without-shiny.html)
148-
chapter of the [plotly book](https://cpsievert.github.io/plotly_book/)
149-
provides even more background. There are also numerous demos shipped
150-
with the package which provide nice examples (list all the demos via
151-
`demo(package = "plotly")`).
152-
153-
**plotly**’s **crosstalk** functionality aims to provide tools for
154-
interactively exploring subsets of your data with a fixed definition
155-
from data to plot. If you need more flexibility, you can always embed
156-
**crosstalk** plots within a larger **shiny** app, or even [access and
157-
respond to any plotly event within
158-
shiny](https://cpsievert.github.io/plotly_book/linking-views-with-shiny.html),
159-
but adding **shiny** into the equation comes with a cost – the result is
160-
no longer standalone HTML (harder to share/host) and linking views
161-
requires fairly sophicated knowledge/use of shiny’s reactive programming
162-
framework.
163-
164-
## Examples and documentation
165-
166-
We have numerous online examples on <https://plot.ly/r/> and
167-
<https://plot.ly/ggplot2/>, but a more comprehensive write-up is also
168-
available at <https://plotly-book.cpsievert.me/>. The package itself
169-
ships with a number of demos (list them by running `demo(package =
170-
"plotly")`) and shiny/rmarkdown examples (list them by running
171-
`plotly_example("shiny")` or `plotly_example("rmd")`).
172-
[Carson](https://cpsievert.me) also keeps numerous [slide
173-
decks](https://talks.cpsievert.me) with useful examples and concepts.
100+
## Learn more
101+
102+
To learn more about special features that the plotly R package provides (e.g., [client-side linking](https://plotly-r.com/client-side-linking.html), [**shiny** integration](https://plotly-r.com/linking-views-with-shiny.html), [editing and generating static images](https://plotly-r.com/publish.html), [custom events in JavaScript](https://plotly-r.com/javascript.html), and more), see <https://plotly-r.com>. You may already be familiar with existing plotly documentation (e.g., <https://plot.ly/r/>), which is essentially a language-agnostic how-to guide for learning plotly.js, whereas <https://plotly-r.com> is meant to be more wholistic tutorial written by and for the R user. The package itself ships with a number of demos (list them by running `demo(package = "plotly")`) and shiny/rmarkdown examples (list them by running `plotly_example("shiny")` or `plotly_example("rmd")`). [Carson](https://cpsievert.me) also keeps numerous [slide decks](https://talks.cpsievert.me) with useful examples and concepts.
174103

175104
## Contributing
176105

0 commit comments

Comments
 (0)