Reputation: 1946
I am wishing to create an interactive figure to send to a co-worker, who does not have nor use R. The figure that I am creating contains confidential data.
I am a beginner at using ggplotly and understand interactive figures can be posted online, however, I don't wish for this figure to be publicly available. I have been using the offline plotting version. I understand interactive reports, including plotly figures, can be compiled using R Markdown. However, if I run this plot in R and create a standalone html file, will the plot still be posted via my plotly account? If so, how can I go about doing this?
Below is an example of the interactive figure I wish to send to my co-worker, using an inbuilt dataset for example purposes.
# Require
library(plotly)
# Create
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
# Plot
qplot(carat, price, data=dsamp, colour=clarity)
# Call
ggplotly()
Upvotes: 3
Views: 5225
Reputation: 753
If you render the file as html, you can just email it to your coworker without hosting it anywhere. From there they can choose to open the html file in their browser, and it will still have the interactive graph generated through plotly. For example, if I had the following code in an rmarkdown document, I could simply press knit at the top left corner of rstudio.
---
title: "RmarkdownExample"
author: "be_green"
date: "January 24, 2017"
output: html_document
---
Here is the graph I generated.
```{r setup, message = FALSE, echo = FALSE, warning=FALSE}
# Require
library(plotly)
# Create
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
# Plot
g <- qplot(carat, price, data=dsamp, colour=clarity)
# Call
ggplotly(g)
```
The file generated will be automatically saved in your working directory, and you can attach it to an email or save it to a shared drive just like any other file. From there your coworker can open it and nothing will be public!
Upvotes: 4