Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interactive plots on local .html via .rmd or Shiny

I'm trying to build a .html file via RStudio in to have following function(simplified).

plot1:a simple time series plot of $y_t$, where user can manually pull/drag each dot to change it's values a each time point.

plot2:a time series dependent on $y_t$, such as $f(y_t)=2*y_t+1$, once the value in plot1 changed, the plot2 will also change accordingly.

I want the .html self contained, not cloud based. I'm thinking of plotly, shininy/knitr, but I'm not sure if I'm in the direction or how to connect the dots. Hope anyone can point me to the right direction.

like image 231
xappppp Avatar asked Jul 06 '17 17:07

xappppp


People also ask

How do I make my Ggplot interactive shiny?

Adding interactivity is easy: it just requires using one option in plotOutput() , and then the information about mouse events will be available via the input object. You can use mouse events to read mouse coordinates, select or deselect points, and implement zooming.

What is an .RMD file?

An RMD file is an R Markdown file created using RStudio, an open-source Integrated Development Environment (IDE) for the R programming language. It contains YAML metadata, Markdown-formatted plain text, and chunks of R code that, when rendered using RStudio, combine to form a sophisticated data analysis document.

How do you do RMD in HTML?

To transform your markdown file into an HTML, PDF, or Word document, click the “Knit” icon that appears above your file in the scripts editor. A drop down menu will let you select the type of output that you want. When you click the button, rmarkdown will duplicate your text in the new file format.

Can you make R Markdown interactive?

R Markdown documents are a perfect platform for interactive content. To make your documents interactive, add: Interactive JavaScript visualizations based on htmlwidgets, or. Reactive components made with Shiny.


1 Answers

A self-contained/client-side html report sounds well-suited for flexdashboard. It's based on R Markdown, and therefore can accommodate Shiny elements.

I don't know if you can modify values with a mouse, but you can certainly modify values with sliders and other inputs, as well as have a second plot react to a first plot.

You may see some more possibilities in the gallery.

like image 172
wibeasley Avatar answered Oct 01 '22 23:10

wibeasley