rstudio / dygraphs

R interface to dygraphs
http://rstudio.github.io/dygraphs
Other
364 stars 193 forks source link

Is there a way to plot multiple charts in RStudio's viewer? #59

Open Fluxionist opened 9 years ago

Fluxionist commented 9 years ago

Sorry if I am posting at the wrong place. What I want is a stock price chart above a trading volume chart. I know that you can use group to synchronize them, but in RStudio two dygraphs are plotted separately into different pages. Is there a way to put these two (or even more) charts on the same plot in RStudio's viewer, like ggplot2's facets?

jjallaire commented 9 years ago

No there isn't a way to do this in the Viewer. However, if you create an R Markdown document you can create the layout you want and then set the option to preview R Markdown within the Viewer.

On Tue, Jun 9, 2015 at 8:11 AM, Fluxionist notifications@github.com wrote:

Sorry if I am posting at the wrong place. What I want is a stock price chart above a trading volume chart. I know that you can use group to synchronize them, but in RStudio two dygraphs are plotted separately into different pages. Is there a way to put these two (or even more) charts on the same plot in RStudio's viewer, like ggplot2's facets?

— Reply to this email directly or view it on GitHub https://github.com/rstudio/dygraphs/issues/59.

MySchizoBuddy commented 9 years ago

an example would be helpful

AMarthaller commented 9 years ago

An easy way to do this is to create your dyGraph variables in an R file and the just source it in an RMarkdown file and press the Knit to HTML button.

{r, echo=FALSE, include=FALSE} source("DyGraphSample.R")

{r, echo=FALSE} dyGraph1 dyGraph2

You must include the ``` marks before the {x} directives above but the site supports RMarkdown and I'm not sure how to escape it.