Skip to content

Commit 5f25849

Browse files
committed
change to api_download_plot
1 parent 29b9197 commit 5f25849

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

_posts/r/fundamentals/2015-07-30-get-requests.Rmd

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,40 +33,45 @@ Check out [this post](http://moderndata.plot.ly/upgrading-to-plotly-4-0-and-abov
3333
library(plotly)
3434
packageVersion('plotly')
3535
```
36-
#### Download Plotly Graphs into R
3736

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.
3940

4041
For example, to download [https://plot.ly/~cpsievert/559](https://plot.ly/~cpsievert/559) into R, call:
4142

4243
```{r, results = 'hide'}
4344
library(plotly)
44-
fig <- get_figure("cpsievert", "559")
45+
fig <- api_download_plot("559", "cpsievert")
4546
```
4647

4748
```{r, echo=FALSE}
48-
plotly_POST(fig, filename="getRequests/download")
49+
api_create(fig, filename="getRequests/download")
4950
```
5051

51-
#### Edit Downloaded Graph
52+
### Edit Downloaded Graph
5253
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.
5354

5455
```{r, results = 'hide'}
5556
p <- layout(fig, title = paste("Modified on ", Sys.time()))
5657
```
5758

5859
```{r, echo=FALSE}
59-
plotly_POST(p, filename="getRequests/modify")
60+
api_create(p, filename="getRequests/modify")
6061
```
6162

6263
### Adding a trace to a subplot figure
6364

6465
```{r, results = 'hide'}
65-
fig <- get_figure("chelsea_lyn", "6343")
66+
fig <- api_download_plot("6343", "chelsea_lyn")
6667
6768
p <- add_lines(fig, x = c(1, 2), y = c(1, 2), xaxis = "x2", yaxis = "y2")
6869
```
6970

7071
```{r, echo=FALSE}
71-
plotly_POST(p, filename="getRequests/subplot")
72+
api_create(p, filename="getRequests/subplot")
7273
```
74+
75+
### Reference
76+
77+
See `help("api")`

_posts/r/fundamentals/2015-07-30-get-requests.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ layout: base
77
thumbnail: thumbnail/get-requests.jpg
88
language: r
99
has_thumbnail: true
10-
thumbnail: thumbnail/spectral.jpg
1110
display_as: file_settings
1211
output:
1312
html_document:
@@ -33,23 +32,24 @@ packageVersion('plotly')
3332
```
3433

3534
```
36-
## [1] '4.5.6.9000'
35+
## [1] '4.7.0'
3736
```
38-
#### Download Plotly Graphs into R
3937

40-
Download Plotly figures directly into R with `get_figure()`. This takes the `username` and the `plot_id` as arguments.
38+
### Download Plotly Graphs into R
39+
40+
Download Plotly figures directly into R with `api_download_plot()`. This takes the `plot_id` and the `username` as arguments.
4141

4242
For example, to download [https://plot.ly/~cpsievert/559](https://plot.ly/~cpsievert/559) into R, call:
4343

4444

4545
```r
4646
library(plotly)
47-
fig <- get_figure("cpsievert", "559")
47+
fig <- api_download_plot("559", "cpsievert")
4848
```
4949

5050
<iframe src="https://plot.ly/~RPlotBot/4294.embed" width="800" height="600" id="igraph" scrolling="no" seamless="seamless" frameBorder="0"> </iframe>
5151

52-
#### Edit Downloaded Graph
52+
### Edit Downloaded Graph
5353
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.
5454

5555

@@ -63,9 +63,13 @@ p <- layout(fig, title = paste("Modified on ", Sys.time()))
6363

6464

6565
```r
66-
fig <- get_figure("chelsea_lyn", "6343")
66+
fig <- api_download_plot("6343", "chelsea_lyn")
6767

6868
p <- add_lines(fig, x = c(1, 2), y = c(1, 2), xaxis = "x2", yaxis = "y2")
6969
```
7070

7171
<iframe src="https://plot.ly/~RPlotBot/3133.embed" width="800" height="600" id="igraph" scrolling="no" seamless="seamless" frameBorder="0"> </iframe>
72+
73+
### Reference
74+
75+
See `help("api")`

0 commit comments

Comments
 (0)