-
Notifications
You must be signed in to change notification settings - Fork 0
Interactive graphics for the tourr package using python
Tour algorithms allow the visualization of multivariate (pD) data with animated computer graphics. A typical tour display shows data points in a scatterplot where linear projections are used to reduce the dimension from pD to 2D. A grand tour will alternate between randomly picking new projections (the target plane) and interpolating between the current view (the starting plane) to the target. In this way the change in view is shown as a smooth rotation in the pD space, and the viewer can extrapolate high-dimensional features from the 2D views.
Tour methods are in particular useful if they are embedded in an interactive graphics system, as was available in XGobi and GGobi. The R package tourr implements algorithms for the selection of planes, their interpolation and also offers different display functions. However, these displays are not interactive and while implementation of an interactive system from R is possible using for example shiny and plotly, these do not offer the desired level of interactivity.
On the other hand python graphics (in particular via matplotlib) offers better interactive graphics options, but there is no full implementation of tour functionalities available. This project will integrate the best of these two worlds, using the already implemented functionality in the tourr package and connecting it to python for an interactive interface that in particular also allows the manual control of the projection. The new interface should be accessible both to R and python users and thus allow the python community to profit from the tourr implementation.
An attempt at an interactive interface using shiny and plotly was made in the archived package galahr, this was showing pre-recorded tour paths in a plotly display, but was found to be too slow at re-drawing the display for each interpolation step. In addition, the curser tracking was not precise enough for manual manipulation of the projection shown.
A better performance is achieved using htmlwidgets as implemented in the detourr package and in the langevitour. In the detourr implementation a tour is precomputed in R, and the projected points for the full animation, limiting interactions to the display. In langevitour a subset of tour algorithms has been re-implemented in Javascript.
Efforts to include manual controls have been made independently of the R implementation in tourr, using interactive graphics in Mathematica and python, and we would want to integrate these capabilities with what is available in tourr.
The aim of the project is to write an integrated package that dynamically switches between R (in particular the tourr package) and python (in particular for interactive graphics). The project is based on the prototype for the manual tour in python, and can draw on experience from previous work on graphical interfaces. It is defined in three milestones:
- Using reticulate and rpy2 we establish an interface between the tourr package and the python graphics such that python can ask tourr for the next projection to be drawn at each step, such that we can also run a grand and guided tour in the same interface.
- Extending on this interface we next want to provide input from the interactive graphical interface back to tourr. This will enable us to use manually found projections as an input in tourr, for example to launch a local tour in the neighborhood of the selected view, or to use it as the starting plane to further optimize in a guided tour.
- The final step will introduce brushing in the graphical interface, such that the selection can be used as input in tourr, in particular for the optimization in a guided tour (e.g. optimize an index where the selected subset differs most from the remaining distribution).
The result of the project should be a new package that is accessible for both R and python users, with through documentation of the functionalities. Since such a close integration of the two languages is not common, this aspect may also be documented in a journal article.
The new package will bring some of the interactivity known from legacy systems such as GGobi to the R community. This is indeed perceived as a large weakness of the currently available functionality in tourr. In addition making the tourr implementation available to the python community is also expected to have a significant impact. Furthermore, the project serves as a test case for close integration between R and python.
Contributors, please contact mentors below after completing at least one of the tests below.
- EVALUATING MENTOR: Ursula Laa [email protected] has contributed to the tourr package and has worked on interactive interfaces.
- Dianne Cook [email protected] is an expert in visualisation and author and maintainer of the tourr package. Di has co-mentored more than 10 successful GSoC projects.
Contributors, please do one or more of the following tests before contacting the mentors above.
MENTORS: write several tests that potential contributors can do to demonstrate their capabilities for this particular project. Ask some hard questions that will give you insight about how the contributors write code to solve problems. You'll see that the harder the questions that you ask, the easier it will be for you to choose between the contributors that apply for your project! Please modify the suggestions below to make them specific for your project.
- Easy: install the tourr package, look up the
animate
function and run the examples. Find out how you can run a guided tour and show an example. - Medium: make an interactive scatterplot in python using matplotlib. The interactivity could for example be a brush: with interactive selection we can highlight points.
- Hard: using a dataset in R pass the data points to python and show them in your interactive display. For example you can extract a projection from tourr, project the flea data onto 2D and then show that projection in the matplotlib graph.
Contributors, please post a link to your test results here.
- Sumit Gupta, LINK TO GITHUB PROFILE, LINK TO TEST RESULTS.
- Quynh Nguyen, Github, Application
- Matthias Medl Github/application