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: _posts/r/fundamentals/2015-07-30-get-requests.Rmd
+13-8Lines changed: 13 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -33,40 +33,45 @@ Check out [this post](http://moderndata.plot.ly/upgrading-to-plotly-4-0-and-abov
33
33
library(plotly)
34
34
packageVersion('plotly')
35
35
```
36
-
#### Download Plotly Graphs into R
37
36
38
-
Download Plotly figures directly into R with `get_figure()`. This takes the `username` and the `plot_id` as arguments.
37
+
### Download Plotly Graphs into R
38
+
39
+
Download Plotly figures directly into R with `api_download_plot()`. This takes the `plot_id` and the `username` as arguments.
39
40
40
41
For example, to download [https://plot.ly/~cpsievert/559](https://plot.ly/~cpsievert/559) into R, call:
41
42
42
43
```{r, results = 'hide'}
43
44
library(plotly)
44
-
fig <- get_figure("cpsievert", "559")
45
+
fig <- api_download_plot("559", "cpsievert")
45
46
```
46
47
47
48
```{r, echo=FALSE}
48
-
plotly_POST(fig, filename="getRequests/download")
49
+
api_create(fig, filename="getRequests/download")
49
50
```
50
51
51
-
####Edit Downloaded Graph
52
+
### Edit Downloaded Graph
52
53
Once the figure is downloaded, you can edit it like any plotly object. This will create a new figure unless you specify the same filename as the figure that you downloaded.
53
54
54
55
```{r, results = 'hide'}
55
56
p <- layout(fig, title = paste("Modified on ", Sys.time()))
56
57
```
57
58
58
59
```{r, echo=FALSE}
59
-
plotly_POST(p, filename="getRequests/modify")
60
+
api_create(p, filename="getRequests/modify")
60
61
```
61
62
62
63
### Adding a trace to a subplot figure
63
64
64
65
```{r, results = 'hide'}
65
-
fig <- get_figure("chelsea_lyn", "6343")
66
+
fig <- api_download_plot("6343", "chelsea_lyn")
66
67
67
68
p <- add_lines(fig, x = c(1, 2), y = c(1, 2), xaxis = "x2", yaxis = "y2")
Once the figure is downloaded, you can edit it like any plotly object. This will create a new figure unless you specify the same filename as the figure that you downloaded.
54
54
55
55
@@ -63,9 +63,13 @@ p <- layout(fig, title = paste("Modified on ", Sys.time()))
0 commit comments