Interactive plots on local .html via .rmd or Shiny - r

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.

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.

Related

rectangles on Grace plots

I have been using Grace (xmgrace) plotting for many years. I recently had an important idea for my work, and it involves rectangles on my plots. Grace supports rectangles (called "boxes"), but when I use a filled "box" it blocks my data curves. I want the curves to show over the filled rectangles. This is driving me nuts. Does anyone know how to put the filled rectangles in the background so they don't block data curves? Thanks.
Unfortunately there is no option in the xmgrace graphical interface that allows you to modify the z order of drawing objects such as boxes:
I also saved the graph as an .agr file and viewed it in a text editor. There doesn't seem to be any flag within the file format to modify z position, either.
Same story if you save a parameter file and check it in a text editor.
So it looks like it is really not possible in xmgrace.
One workaround would be to print to a postscript, EPS or SVG file and open it inside a vector graphics program such as Inkscape (results vary, you might need to experiment with filetypes to see which works best). Then you can easily alter the z order of objects.

Is there a way to save and quickly reopen surface plots in IDL (Interactive Data Language)?

I was wondering if there is a way to save surface plots in IDL in a way that is convenient to reopen them. As far as I am aware there are only two ways of doing this:
The first way is to save your surface plot as an image e.g. png. The trouble with this is that the viewing angle is fixed and you can no longer drag with the mouse to rotate the surface plot.
The second way is to save the code which generates the plot. Trouble with this is the code often generates loads of plots which are usually just saved as images.
I would like something you can open easily and which opens the surface plot as though you had just run the code to generate it. So that you are free to rotate it by dragging the mouse.
Does this exist?
I only have IDL version 8.3.
If you 'Generate code/save data' (either via the toolbar at the bottom of the window or via the generateCode method with the SAVEDATA keyword), you get a .sav file that contains your plot. Either use the code generated to restore it, or use the generated code as an example to write your own.

Get data from mouse events in plot.ly or ggvis within r (not shiny)

I want to use interactive plots in R to be able to select x intervals in plots, i have tried plot.ly and ggvis and it seems that the mouse click on the plot followed by horizontal drag, used for zooming is exactly what i want, but zoom would have to be disabled and the [x start, x end] values must be returned to R. Any ideas if this is possible, and if so, how?
I tried to make tooltip function available with static_output (without shiny).
You can check my fork (https://github.com/lujiacn/ggvis
), enable the tooltip by default, in Rstudio and output html widget.
The way is put tooltip content in one variable called "tooltip". If no "tooltip" variable, wills show the all values linked to the data.

How to show an iplot without opening an additional window into r shiny

I'm trying to build interactive graphs in my shiny app. The user should be able to click on bars and see where the cases are displayed in another graph for example like a scatterplot next to the barplot.
There are different r packages, that are doing a great job: iplot, rggobi, acinonyx. I also found qtlcharts, but it does not exactly what I wanted. The problem is, I can't figure out, how to integrate different iplots into my shiny app boxes. Is there any way preventing iplots from opening separate windows for the graphs?
In acinonyx you can say window=FALSE, which prevents opening the java window of the graph. But the graph isn't displayed in the box as well. You could add/move the iplot into icontainer, iVisual or iWindow, but none of them can be integrated into the shiny boxes in the ui without printing the error: unsupported data frame or doing nothing at all.
I found the answer to my question: building reactive ggplots in shiny and adding coloured layers to one plot if the other plot is clicked will do the job.

LocusZoom standalone change x-axis and use the plots in a script

I am using the standalone LocusZoom software,but I am having two problems:
I have to create a plot showing only position on the x-axis (not showing the genes). If I just use showGenes=FALSE with nothing else the genes still appear, but if I use rfrows=0 then the genes are not shown, but the problem is that also the x-axis label with the positions disappears. Is there a way to only show the position label? It looks like the only way to do this is to modify the original script...
Is there a way to use several plots created using LocusZoom in an R script to position many plots into one unique figure? (output is a pdf for now) There is an option listed in the LocusZoom webpage (http://genome.sph.umich.edu/wiki/LocusZoom_Standalone) called "prelude" but I cannot get more info on how to use it.
If you have any suggestions for either of these two issues it would be very helpful! Thanks!!

Resources