Skip to content

Commit 9905d6c

Browse files
author
Joseph Damiba
authored
Merge pull request #15 from plotly/update-r-docs
Spin off chart studio related content from r/getting-started into its own post
2 parents 93c1427 + a635477 commit 9905d6c

File tree

1 file changed

+21
-103
lines changed

1 file changed

+21
-103
lines changed

r/2015-07-30-getting-started.Rmd

Lines changed: 21 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Getting Started with Plotly
33
permalink: r/getting-started/
4-
description: Get started with Plotly's graphing library
4+
description: How to get started making charts with Plotly's R graphing library.
55
page_type: example_index
66
layout: base
77
language: r
@@ -16,130 +16,48 @@ knitr::opts_chunk$set(message = FALSE, warning=FALSE)
1616

1717
# Getting Started with Plotly for R
1818

19-
Plotly is an R package for creating interactive web-based graphs via the open source JavaScript graphing library [plotly.js](http://plot.ly/javascript).
20-
As of version 2.0 (November 17, 2015), Plotly graphs are rendered *locally* through the [htmlwidgets](http://www.htmlwidgets.org/) framework.
19+
[`plotly`](https://github.com/ropensci/plotly) is an R package for creating interactive web-based graphs via the open source JavaScript graphing library [`plotly.js`](http://plot.ly/javascript).
2120

21+
As of version 2.0 (November 17, 2015), graphs created with the `plotly` R package are rendered *locally* through the [`htmlwidgets`](http://www.htmlwidgets.org/) framework.
2222

23-
#### Installation
23+
## Installation
2424

25-
Plotly is now on CRAN!
25+
### Download from CRAN
2626

27-
```r
28-
install.packages("plotly")
29-
```
30-
31-
Or install the latest development version (on GitHub) via devtools:
27+
Use the `install.package()` function to install the [`plotly R package`](https://cran.r-project.org/web/packages/plotly/index.html) from [CRAN](https://cran.r-project.org/!
3228

3329
```r
34-
devtools::install_github("ropensci/plotly")
30+
install.packages("plotly")
3531
```
3632

37-
<br>
38-
RStudio users should download the latest [RStudio release](https://www.rstudio.com/products/rstudio/download/) for compatibility with htmlwidgets.
33+
### Download from GitHub
3934

40-
#### Initialization for Offline Plotting
41-
42-
By default, Plotly for R runs locally in your web browser or in the R Studio viewer.
35+
Alternatively, you can install the latest development version of `plotly` from GitHub via the [`devtools`](https://cran.r-project.org/web/packages/devtools/index.html) R package:
4336

4437
```r
45-
library(plotly)
46-
p <- plot_ly(midwest, x = ~percollege, color = ~state, type = "box")
47-
p
38+
devtools::install_github("ropensci/plotly")
4839
```
4940

50-
Simply printing the Plotly object will render the chart locally in your web browser or in the R Studio viewer.
41+
### Note For `RStudio` Users
5142

52-
<iframe style="border: none; width: 100%; height: 500px;" src="https://plot.ly/~chriddyp/1799.embed"></iframe>
43+
`RStudio` users should ensure that they are using the latest [RStudio release](https://www.rstudio.com/products/rstudio/download/) in order to ensure compatibility with the `htmlwidgets` R package.
5344

54-
Plotly graphs are interactive. Click on legend entries to toggle traces, click-and-drag on the chart to zoom, double-click to autoscale, shift-and-drag to pan.
45+
## Rendering Charts
5546

56-
#### Initialization for Online Plotting
47+
By default, the `plotly` R package runs locally in your web browser or in the `RStudio` viewer.
5748

58-
You can publish your charts to the web with Plotly's web service.
59-
60-
1 - [Create a free Plotly account](https://plot.ly/api_signup):<br>
61-
A Plotly account is required to publish charts online. It's free to get started, and you control the privacy of your charts.
62-
63-
2 - Save your authentication credentials<br>
64-
Find your authentication API keys [in your online settings](https://plot.ly/settings/api). Set them in your R session with:
65-
66-
```r
67-
Sys.setenv("plotly_username"="your_plotly_username")
68-
Sys.setenv("plotly_api_key"="your_api_key")
69-
```
70-
71-
Save these commands in your [.Rprofile](http://www.statmethods.net/interface/customizing.html) file to be run every time you start R.
72-
73-
3 - Publish your graphs to Plotly with `api_create`
74-
75-
Use `filename` to title the file in your Plotly account.
76-
77-
```r
49+
```{r}
7850
library(plotly)
7951
p <- plot_ly(midwest, x = ~percollege, color = ~state, type = "box")
80-
api_create(p, filename = "r-docs-midwest-boxplots")
81-
```
82-
83-
4 (optional) - Suppress auto open
84-
85-
When following the instructions above, `api_create(p)` will auto open the created URL in the browser. To suppress this behavior, you can update your browser options in R:
86-
87-
```r
88-
options(browser = 'false')
89-
api_create(p, filename = "r-docs-midwest-boxplots")
90-
```
91-
92-
#### Special Instructions for Chart Studio Enterprise Users
93-
94-
Your API key for account on the public cloud will be different than the API key in [Chart Studio Enterprise](https://plot.ly/product/enterprise/). Visit <https://plotly.your-company.com/settings/api/> to find your Chart Studio Enterprise API key. Remember to replace "your-company.com" with the URL of your Chart Studio Enterprise server.
95-
96-
If your company has a Chart Studio Enterprise server, change the R API endpoint so that it points to your company's Plotly server instead of Plotly's cloud.
97-
98-
In your .RProfile write:
99-
100-
```r
101-
Sys.setenv("plotly_domain"="https://plotly.your-company.com")
52+
p
10253
```
10354

104-
Remember to replace "your-company" with the URL of your Chart Studio Enterprise server.
105-
106-
<div class="row centered btnrow">
107-
<a href="/r/" class="button no_underline">Make your first graph</a>
108-
</div>
109-
110-
#### Online Plot Privacy
111-
112-
Plots can be set to three different type of privacies: public, private or secret.
113-
114-
* **public:**
55+
Simply printing the plot object will render the chart locally in your web browser or in the `RStudio` viewer.
11556

116-
Anyone can view this graph. It will appear in your profile
117-
and can appear in search engines. You do not need to be
118-
logged in to Plotly to view this chart.
57+
Graphs created with the `plotly` R package are interactive!
11958

120-
* **private:**
59+
Click on legend entries to hide/show traces, click-and-drag on the chart to zoom, double-click to autoscale, shift-and-drag to pan.
12160

122-
Only you can view this plot. It will not appear in the
123-
Plotly feed, your profile, or search engines. You must be
124-
logged in to Plotly to view this graph. You can privately
125-
share this graph with other Plotly users in your online
126-
Plotly account and they will need to be logged in to
127-
view this plot. This option is only available for Personal
128-
and Professional subscribers.
61+
## Next Steps
12962

130-
* **secret:**
131-
132-
Anyone with this secret link can view this chart. It will
133-
not appear in the Plotly feed, your profile, or search
134-
engines. If it is embedded inside a webpage or an IPython
135-
notebook, anybody who is viewing that page will be able to
136-
view the graph. You do not need to be logged in to view
137-
this plot. This option is only available for Personal
138-
and Professional subscribers.
139-
140-
By default all plots are set to public. Users with a free account are limited to creating public plots. If you have private storage needs, please visit [Plotly products page](https://plot.ly/products). If you're a [Personal or Professional USER](https://plot.ly/settings/subscription/?modal=true&utm_source=api-docs&utm_medium=support-oss) and would like the setting for your plots to be private, you can specify sharing as private:
141-
142-
```r
143-
api_create(filename = "private-graph", sharing = "private")
144-
```
145-
For more examples on privacy settings please visit [R privacy documentation](https://plot.ly/r/privacy/)
63+
Once you have installed the `plotly` R package, learn more about the [fundamentals of making charts](https://plot.ly/r/plotly-fundamentals/) and start making [basic charts](https://plot.ly/r/basic-charts/).

0 commit comments

Comments
 (0)