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: vignettes/subplot.Rmd
+11-17Lines changed: 11 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ knitr::opts_chunk$set(
21
21
22
22
## Introduction
23
23
24
-
The `subplot()` function provides a flexible interface for arranging multiple **plotly** plots in a single view. There are a few different ways to use `subplot()`, but the simplest way to pass plotly visualization objects directly to `subplot()`.
24
+
The `subplot()` function provides a flexible interface for arranging multiple **plotly** plots in a single view. The simplest way to use it is to pass plotly visualizations directly to `subplot()`.
25
25
26
26
```{r}
27
27
library(plotly)
@@ -54,7 +54,7 @@ Conceptually, `subplot()` provides a way to place a collection of plots into a t
This can be quite useful for a number of visualizations, for example, a joint density plot:
57
+
This flexibility is quite useful for a number of visualizations, for example, a joint density plot (the new [heatmaply](https://github.com/talgalili/heatmaply) package is another good example).
58
58
59
59
```{r}
60
60
x <- rnorm(100)
@@ -75,11 +75,8 @@ Note that, since `subplot()` returns a plotly object, any [layout attribute](htt
75
75
76
76
## Recursive subplots
77
77
78
-
The `subplot()` function is designed to work recursively so that you can have subplots of subplots. This idea is useful when your desired layout doesn't conform to the table structure described in the previous section. In fact, you can think of a subplot of subplots like an excel spreadsheet with merged cells.
78
+
The `subplot()` function is designed to work recursively so that you can have subplots of subplots. This idea is useful when your desired layout doesn't conform to the table structure described in the previous section. In fact, you can think of a subplot of subplots like a spreadsheet with merged cells.
The concept is particularly useful when you want plot(s) in a given row to have different widths from plot(s) in another row.
99
95
100
96
```{r, fig.height = 6}
101
97
# specify some map projection/options
@@ -125,13 +121,11 @@ subplot(
125
121
)
126
122
```
127
123
124
+
## ggplot2 subplots
128
125
129
-
## subplots with ggplot2
130
-
131
-
132
-
The `subplot()` function also understands ggplot2 objects and converts them via `ggplotly()`.
126
+
The `subplot()` function also understands ggplot2 objects, and converts them to an interactive web-based version via `ggplotly()` before arranging them in the final layout.
133
127
134
-
```{r, fig.height = 8}
128
+
```{r, fig.height = 6}
135
129
e <- tidyr::gather(economics, variable, value, -date)
0 commit comments