Thanks to visit codestin.com
Credit goes to github.com

Skip to content

update copy on r/chart-studio docs #1663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
name: Get Requests
permalink: python/v3/get-requests/
description: How to download plotly users's public graphs and data with python.
name: Working With Chart Studio Graphs
permalink: python/v3/working-with-chart-studio-graphs/
redirect_from:
- python/v3/get-requests/
description: How to download Chart Studio users' public graphs and data with Python.
layout: base
thumbnail: thumbnail/get-requests.jpg
language: python/v3
Expand Down
7 changes: 4 additions & 3 deletions _posts/python/chart-studio/2019-07-03-get-requests.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
description: How to download plotly users's public graphs and data with python.
description: How to download Chart Studio users' public graphs and data into Python.
display_as: chart_studio
language: python
layout: base
name: Get Requests
name: Working With Chart Studio Graphs
order: 8
permalink: python/get-requests/
permalink: python/working-with-chart-studio-graphs/
redirect_from: python/get-requests
thumbnail: thumbnail/spectral.jpg
v4upgrade: True
---
Expand Down
78 changes: 30 additions & 48 deletions _posts/r/chart-studio/2015-04-09-static-image_r_index.Rmd
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
---
description: How to export plotly graphs as static images in R. Plotly supports png,
svg, jpg, and pdf image export.
description: How to export R graphs as static images using Chart Studio.
display_as: chart_studio
language: r
layout: base
name: Static Image Export
name: Exporting Graphs As Static Images Using Chart Studio
order: 2
output:
html_document:
keep_md: true
page_type: example_index
permalink: r/static-image-export/
permalink: r/chart-studio-image-export/
sitemap: false
thumbnail: thumbnail/png-export.png
---
Expand All @@ -20,64 +19,42 @@ knitr::opts_chunk$set(message = FALSE, warning=FALSE)
Sys.setenv("plotly_username"="RPlotBot")
Sys.setenv("plotly_api_key"="q0lz6r5efr")
```
### Supported File Formats

### New to Plotly?
With the `plotly` R package, you can export graphs you create as static images in the `.png` and/or `.jpg`/`.jpeg` file formats for free using the [Chart Studio web service](https://chart-studio.plot.ly/create/#/).

Plotly's R library is free and open source!<br>
[Get started](https://plot.ly/r/getting-started/) by downloading the client and [reading the primer](https://plot.ly/r/getting-started/).<br>
You can set up Plotly to work in [online](https://plot.ly/r/getting-started/#hosting-graphs-in-your-online-plotly-account) or [offline](https://plot.ly/r/offline/) mode.<br>
We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-documentation/images/r_cheat_sheet.pdf) (new!) to help you get started!
Currently, exporting graphs you create as static images in the `.eps`, `.svg`, and/or `.pdf` format is a feature that is available only to users of [Chart Studio Enterprise](https://plot.ly/online-chart-maker/).

### Version Check
**Note:** It is important to be aware that R graphs containing WebGL-based traces (i.e. of type `scattergl`, `heatmapgl`, `contourgl`, `scatter3d`, `surface`, `mesh3d`, `scatterpolargl`, `cone`, `streamtube`, `splom`, and/or `parcoords`) will include encapsulated rasters instead of vectors for some parts of the image if they are exported as static images in a vector format like `.eps`, `.svg`, and/or `.pdf`.

Version 4 of Plotly's R package is now [available](https://plot.ly/r/getting-started/#installation)!<br>
Check out [this post](http://moderndata.plot.ly/upgrading-to-plotly-4-0-and-above/) for more information on breaking changes and new features available in this version.
### Exporting Chart Studio Charts As Static Images

```{r}
library(plotly)
packageVersion('plotly')
```

### Supported Formats

The common image formats: 'PNG', 'JPG/JPEG' are supported. In addition, formats like 'EPS', 'SVG' and 'PDF' are also available for user with a Personal or Professional subscription. You can get more details on our [pricing page] (https://plot.ly/products/cloud/)

**Note:** It is important to note that any figures containing WebGL traces (i.e. of type scattergl, heatmapgl, contourgl, scatter3d, surface, mesh3d, scatterpolargl, cone, streamtube, splom, or parcoords) that are exported in a vector format like SVG, EPS or PDF will include encapsulated rasters instead of vectors for some parts of the image.
To export your R graphs as static images using the Chart Studio web service, you can use the built-in `plotly_IMAGE()` function.

To access the image in a particular format, you can either:
#### Create A Chart Studio Account And Get An API Key

To use the `plotly_IMAGE()` function, you will need to have a [Chart Studio account](https://chart-studio.plot.ly/Auth/login/?action=signup#/) and an API key (which can be found [in your Chart Studio account online settings](https://plot.ly/settings/api)). Learn more about [getting started with Chart Studio in R](https://plot.ly/r/getting-started-with-chart-studio).

* use the `orca()` function. [Orca](https://github.com/plotly/orca) is Plotly's command line applications for generating static images.
#### Set Environment Variables In Your R Session

* export the image on plotly's servers using `plotly_IMAGE()`.

* append the format extension to the plot url. i.e. the JPG version of the plot: https://plot.ly/~chris/1638 is available at : https://plot.ly/~chris/1638.jpg.

### Export Locally

`4.7.900` and above includes the `orca()` function (replacing the `export()` function), which exports images locally, but requires the processx package:
Let the R session know about your Chart Studio authorization credentials by setting environment variables using [`Sys.setenv()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Sys.setenv).

```{r, eval = FALSE}
if (!require("processx")) install.packages("processx")

p <- plot_ly(z = ~volcano) %>% add_surface()

orca(p, "surface-plot.svg")
Sys.setenv("plotly_username" = "YOUR USER NAME")
Sys.setenv("plotly_api_key" = "YOUR API KEY")
```

### Export Using Your Plotly Account

Another option is to do image export through your plotly account.
#### Use The Development Version Of The `plotly` R Package

First, you will require the development version of plotly, this can be installed using `devtools::install_github("ropensci/plotly")`. In addition, if you haven't already, let the R package know about your credentials.
You will also need to be using the development version of the `plotly` R package in order to use the `plotly_IMAGE()` function. This can be installed from GitHub using the [`devtools`](https://cran.r-project.org/web/packages/devtools/index.html) R package by running the following command in your R session:


```{r, eval = FALSE}
Sys.setenv("plotly_username" = "YOUR USER NAME")
Sys.setenv("plotly_api_key" = "YOUR API KEY")
```r
devtools::install_github("ropensci/plotly")
```

This option will export the image on plotly's servers and write the content to a local file `"output.png"` in your working directory.
#### Export R Graph As Static Image

The `plotly_IMAGE()` function exports your R plots as static images using the Chart Studio web service. The image will be stored in a file in the working directory of your R session.

```{r}
library(plotly)
Expand All @@ -87,7 +64,12 @@ plotly_IMAGE(p, format = "png", out_file = "output.png")

![](https://images.plot.ly/plotly-documentation/images/output.png)

### Appending File Type to URL
### Alternative Methods Of Exporting Graphs As Static Images In R

#### Local Image Export

As an alternative to using the Chart Studio web service to export your R graphs as static images, you can [use the built-in `orca()` function](https://plot.ly/r/static-image-export) to export images locally.

#### Embed R Charts in RMarkdown Documents

You can also view the static version of any Plotly graph by appending `.png`,
`.pdf`, `.eps`, or `.svg` to the end of the URL. For example, view the static image of <https://plot.ly/~chris/1638> at <https://plot.ly/~chris/1638.png>. See [Using Plotly with rmarkdown/knitr](https://plot.ly/r/knitr/) for a way to embed these links in rmarkdown/knitr (Rmd) files.
See [Embedding Graphs in RMarkdown](https://plot.ly/r/embedding-graphs-in-rmarkdown/) to learn more about embedding R charts in RMarkdown (.Rmd) files.
80 changes: 29 additions & 51 deletions _posts/r/chart-studio/2015-04-09-static-image_r_index.md
Original file line number Diff line number Diff line change
@@ -1,84 +1,57 @@
---
description: How to export plotly graphs as static images in R. Plotly supports png,
svg, jpg, and pdf image export.
description: How to export R graphs as static images using Chart Studio.
display_as: chart_studio
language: r
layout: base
name: Static Image Export
name: Exporting Graphs As Static Images Using Chart Studio
order: 2
output:
html_document:
keep_md: true
page_type: example_index
permalink: r/static-image-export/
permalink: r/chart-studio-image-export/
sitemap: false
thumbnail: thumbnail/png-export.png
---

### New to Plotly?

Plotly's R library is free and open source!<br>
[Get started](https://plot.ly/r/getting-started/) by downloading the client and [reading the primer](https://plot.ly/r/getting-started/).<br>
You can set up Plotly to work in [online](https://plot.ly/r/getting-started/#hosting-graphs-in-your-online-plotly-account) or [offline](https://plot.ly/r/offline/) mode.<br>
We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-documentation/images/r_cheat_sheet.pdf) (new!) to help you get started!
### Supported File Formats

### Version Check
With the `plotly` R package, you can export graphs you create as static images in the `.png` and/or `.jpg`/`.jpeg` file formats for free using the [Chart Studio web service](https://chart-studio.plot.ly/create/#/).

Version 4 of Plotly's R package is now [available](https://plot.ly/r/getting-started/#installation)!<br>
Check out [this post](http://moderndata.plot.ly/upgrading-to-plotly-4-0-and-above/) for more information on breaking changes and new features available in this version.
Currently, exporting graphs you create as static images in the `.eps`, `.svg`, and/or `.pdf` format is a feature that is available only to users of [Chart Studio Enterprise](https://plot.ly/online-chart-maker/).

**Note:** It is important to be aware that R graphs containing WebGL-based traces (i.e. of type `scattergl`, `heatmapgl`, `contourgl`, `scatter3d`, `surface`, `mesh3d`, `scatterpolargl`, `cone`, `streamtube`, `splom`, and/or `parcoords`) will include encapsulated rasters instead of vectors for some parts of the image if they are exported as static images in a vector format like `.eps`, `.svg`, and/or `.pdf`.

```r
library(plotly)
packageVersion('plotly')
```

```
## [1] '4.5.6.9000'
```
### Exporting Chart Studio Charts As Static Images

### Supported Formats
To export your R graphs as static images using the Chart Studio web service, you can use the built-in `plotly_IMAGE()` function.

The common image formats: 'PNG', 'JPG/JPEG' are supported. In addition, formats like 'EPS', 'SVG' and 'PDF' are also available for user with a Personal or Professional subscription. You can get more details on our [pricing page] (https://plot.ly/products/cloud/)
#### Create A Chart Studio Account And Get An API Key

**Note:** It is important to note that any figures containing WebGL traces (i.e. of type scattergl, heatmapgl, contourgl, scatter3d, surface, mesh3d, scatterpolargl, cone, streamtube, splom, or parcoords) that are exported in a vector format like SVG, EPS or PDF will include encapsulated rasters instead of vectors for some parts of the image.
To use the `plotly_IMAGE()` function, you will need to have a [Chart Studio account](https://chart-studio.plot.ly/Auth/login/?action=signup#/) and an API key (which can be found [in your Chart Studio account online settings](https://plot.ly/settings/api)). Learn more about [getting started with Chart Studio in R](https://plot.ly/r/getting-started-with-chart-studio).

To access the image in a particular format, you can either:
#### Set Environment Variables In Your R Session


* use the `orca()` function. [Orca](https://github.com/plotly/orca) is Plotly's command line applications for generating static images.

* export the image on plotly's servers using `plotly_IMAGE()`.

* append the format extension to the plot url. i.e. the JPG version of the plot: https://plot.ly/~chris/1638 is available at : https://plot.ly/~chris/1638.jpg.

### Export Locally

`4.7.900` and above includes the `orca()` function (replacing the `export()` function), which exports images locally, but requires the processx package:
Let the R session know about your Chart Studio authorization credentials by setting environment variables using [`Sys.setenv()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Sys.setenv).


```r
if (!require("processx")) install.packages("processx")

p <- plot_ly(z = ~volcano) %>% add_surface()

orca(p, "surface-plot.png")
Sys.setenv("plotly_username" = "YOUR USER NAME")
Sys.setenv("plotly_api_key" = "YOUR API KEY")
```

### Export Using Your Plotly Account

Another option is to do image export through your plotly account.

First, you will require the development version of plotly, this can be installed using `devtools::install_github("ropensci/plotly")`. In addition, if you haven't already, let the R package know about your credentials.

#### Use The Development Version Of The `plotly` R Package

You will also need to be using the development version of the `plotly` R package in order to use the `plotly_IMAGE()` function. This can be installed from GitHub using the [`devtools`](https://cran.r-project.org/web/packages/devtools/index.html) R package by running the following command in your R session:

```r
Sys.setenv("plotly_username" = "YOUR USER NAME")
Sys.setenv("plotly_api_key" = "YOUR API KEY")
devtools::install_github("ropensci/plotly")
```

This option will export the image on plotly's servers and write the content to a local file `"output.png"` in your working directory.
#### Export R Graph As Static Image

The `plotly_IMAGE()` function exports your R plots as static images using the Chart Studio web service. The image will be stored in a file in the working directory of your R session.


```r
Expand All @@ -89,7 +62,12 @@ plotly_IMAGE(p, format = "png", out_file = "output.png")

![](https://images.plot.ly/plotly-documentation/images/output.png)

### Appending File Type to URL
### Alternative Methods Of Exporting Graphs As Static Images In R

#### Local Image Export

As an alternative to using the Chart Studio web service to export your R graphs as static images, you can [use the built-in `orca()` function](https://plot.ly/r/static-image-export) to export images locally.

#### Embed R Charts in RMarkdown Documents

You can also view the static version of any Plotly graph by appending `.png`,
`.pdf`, `.eps`, or `.svg` to the end of the URL. For example, view the static image of <https://plot.ly/~chris/1638> at <https://plot.ly/~chris/1638.png>. See [Using Plotly with rmarkdown/knitr](https://plot.ly/r/knitr/) for a way to embed these links in rmarkdown/knitr (Rmd) files.
See [Embedding Graphs in RMarkdown](https://plot.ly/r/embedding-graphs-in-rmarkdown/) to learn more about embedding R charts in RMarkdown (.Rmd) files.
46 changes: 19 additions & 27 deletions _posts/r/chart-studio/2015-07-30-filenames.Rmd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
description: R Filenames, folders, and updating Plotly graphs in the plotly cloud.
description: How to update graphs stored in Chart Studio with R.
display_as: chart_studio
language: r
layout: base
name: Updating Plotly Graphs
order: 1
name: Updating Graphs Stored In Chart Studio
order: 9
output:
html_document:
keep_md: true
Expand All @@ -18,44 +18,36 @@ knitr::opts_chunk$set(message = FALSE, warning=FALSE)
Sys.setenv("plotly_username"="RPlotBot")
Sys.setenv("plotly_api_key"="q0lz6r5efr")
```
### New to Plotly?
### Save R Plot To Chart Studio

Plotly's R library is free and open source!<br>
[Get started](https://plot.ly/r/getting-started/) by downloading the client and [reading the primer](https://plot.ly/r/getting-started/).<br>
You can set up Plotly to work in [online](https://plot.ly/r/getting-started/#hosting-graphs-in-your-online-plotly-account) or [offline](https://plot.ly/r/offline/) mode.<br>
We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-documentation/images/r_cheat_sheet.pdf) (new!) to help you get started!

### Version Check

Version 4 of Plotly's R package is now [available](https://plot.ly/r/getting-started/#installation)!<br>
Check out [this post](http://moderndata.plot.ly/upgrading-to-plotly-4-0-and-above/) for more information on breaking changes and new features available in this version.
```{r}
library(plotly)
packageVersion('plotly')
```

#### Save Plot to Server
To create a plotly figure on a plotly server, use `api_create()`.
Using the `plotly` R package, you can create a Chart Studio figure based on your R chart. Simply pass your chart as a parameter to the `api_create()` function:

```{r}
library(plotly)
p <- plot_ly(x = c(1, 2), y = c(1, 2))
p <- plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length)
api_create(p)
```

#### Overwrite Plot
### How To Overwrite An Existing Plot

By default, when you call `api_create()`, a new plot is created in your Chart Studio account with its own unique URL.

If you don't include a filename, a new plot will be made on your online plotly account. If you want to overwrite a plot (i.e., keep the graph served from the same plotly URL), specify a filename. This implicitly overwrites your plotly graph.
If you would like to overwrite an existing plot in your Chart Studio account and keep the same URL, then supply a `filename` as an extra parameter to the `api_create()` function. This will keep the same URL for the plot.

```{r}
api_create(p, filename = "name-of-my-plotly-file")
```

#### Save your Plot in a Folder
If the filename contains "/", it will automatically create a plotly folder. This option is only available for [Pro-Subscriptions](https://plot.ly/products/cloud/)
### Saving Plots In Folders

If the `filename` parameter contains the character "/", then the `api_create()` function will save that plot in a folder in your Chart Studio account.

This option is only available for [Chart Studio Enterprise subscribers](https://plot.ly/online-chart-maker/)

```{r}
api_create(p, filename="r-docs-name-of-my-plotly-file")
api_create(p, filename="r-docs/name-of-my-chart-studio-file")
```

View your Plotly graphs at [https://plot.ly/organize](https://plot.ly/organize).
### Viewing Saved Plots

View the R graphs you have saved in your Chart Studio account at [https://plot.ly/organize](https://plot.ly/organize).
Loading