In R / gwidgets, how to create a new Widget from Scratch - links between boxes / nodes? - r

I want to have an interface that allows to draw links between boxes and save the results (box1 is connected to box2, 3 to 4 and so on) as shown in the picture below:
I do not really know where to start or even if something like this already exists or if it is possible - so I am grateful for any comment on the subject?

The HTkIdentify function in the TeachingDemos package allows you to interactively drag labels to new locations (and part of the return is the coordinates of the new locations) with a line between the point and the label. Visually I think this is similar to what you are asking for. It uses the tcltk package rather than gwidgets. You could modify the code to draw your boxes as above (rather than a data based scatterplot), then based on the final locations of the "labels" you would determine which box was connected to.

Related

How to keep camera orientation fixed in an interactive 3D plot in R/Shiny

I have a 3D rgl plot that users can modify based on some inputs (you can see it in action at https://magalab.shinyapps.io/rgl_test/). But every time the user modifies the input settings, renderer returns to the initial orientation to redraw the model. I want to keep the orientation consistent between updates. I know how to do that in rgl, and there is already another similar question
(Shiny RGL Plot3D: Keep Plot View Orientation On Replot), which did not receive any answer.
There is potentially a relevant topic at shiny app rglwidget get userMatrix to generate another plot with same rotation, but I don't want to see the userMatrix, simply pass it to the open3d().
Unfortunately, I am not familiar with Javascript and Shiny to achieve this. Any pointers will be much appreciated.
In the very newest rgl (version 0.99.18, currently only on R-forge), there's a function called shinyGetPar3d that is designed to do what you want. See example(shinyGetPar3d) for a demonstration of how to use it.

Dynamic plot with hovering popups in R

I am trying to find a way to have a dynamic plot (for the moment I use plotly) in which if you keep the mouse over a certain point it is calling a routine which is showing something, e.g. a photo that is referring to that specific data point. An example is to have the MNIST data-set clustered in 2 dimensions (e.g. using t-SNE) and when you go over the points with the pointer you see the actual digit which stays for that point.

Manually Drawing Curves on R like Paint

I was trying to allow the user to give a curve as input for some analysis. Is there a package that can be used in this regard? Basically, a GUI like paint wherein the user can draw a simple curve and which would be stored in R as a set of data points or as an equation if its a simple curve.
Thanks
Gopher
Reading mouse input
Below is a list of sample approaches to first the problem, from the most complex to simplest (IMHO).
I would recommend that you have a look at the
qtpaint
package.
Less laborious solution may involve looking at the way interactive
plots in Shiny are handled. Using the click option would
enable you to get the mouse cursor position. Together with the Shiny
framework this would provide a convenient wrapper to get mouse input
from a user.
Finally, third approach could rely on making use of the locator function available in the graphics package. Depending on what you intend to do, this may be the simplest solution as you could then use read values to inform generation of your graphic.
Generating graphics
Assuming that you got your values via the locator functionality you could attempt to draw your line using segments. It would be a little fiddly as you would have to translate your coordinates to some placement of the dot in your desired chart but this wouldn't computationally too taxing, just a matter of bring mouse pointer values to some x/y values on the chart.
If you care to update your post with a sample code and reproducible attempts of your previous work, I bet the question will receive more replies. You may find this discussion on making a reproducible example in R helpful.

iplot.setExtendedQuery: How to display custom mouse over information?

Concerning the superb iplots package in R:
By default, pressing CTRL and moving the mouse over a point in a scatter plot shows the x and y values of this point. How can I extend this to also show other attributes, which are not part of the plot, as shown here (see Mondrian screenshot) and as asked here, too?
In Mondrian, this works perfectly well by selecting any attributes within the data overview window and then pressing CTRL + SHIFT on a data point in a scatter plot for example. In iPlots, there is no way to select the attributes like this. I thought iplot.setExtendedQuery() is the key. However, there are no examples on how to use the query string.
Selecting a point plus printing the attributes using sth in the veins of mydata[iset.selected(), ] can't be the only way to go...

R - google slider by gwidgets

I am looking for a way to implement sometimes like the slider in googleVis' annotated timeline: https://developers.google.com/chart/interactive/docs/gallery/annotatedtimeline
I can adjust timeframe by both starting and ending points and move the window as well.
gslider only for one slider per track. Would be better to have two or three sliders in one track.
Any suggestions?
The tkexamp function in the TeachingDemos package is one way to create a graph with properties (including data ranges) that can be adjusted using sliders or other GUI tools.

Resources