This project aims at rendering Volcano in a Shiny application. Volcano is a dataset included in R, and reproduces the topology of Mount Eden (Maunga Whau), a volcano located in Auckland, New Zealand, on a 10x10m grid.
The files load the dataset and plots it using the persp function. The user can then modify the vertical scale and the point of view. Calculations and rendering being done in software mode (i.e., not using any hardware-acceleration technique), there is a serious lag of 1-2 seconds between user interaction and screen update. This shouldn't be a problem as the exercise was about the interaction itself and not the end result.
If you want to experiment further with topological data in R, take a look at:
- this PDF listing various ways to have fun with R and the Volcano dataset
- Shiny-RGL which is a Shiny wrapper for the RGL package. It allows you to use RGL, an openGL package for R, in ShinyApps. Using it would allow you to directly move the volcano with the mouse, instead of relying on sliders to move the point of view.
- GeoTheory also has some nice experiments with maps and R.
This is by no means a list of definitive reference on this topic, I just wanted to share some fun links :)
Simply go to shinyapps.io, to run the app in the browser. The commands are straightforward : you can change the camera point of view in the "Point of view" section and, below, act on the "height scale" (how much the altitude is exagerated) and on the shading (roughly, the shadowing contrast).
- Grab the files or clone the repo
- Fire up R (or better, RStudio), load the ui.R and server.R files
- Set your working directory to where the files are located
- Make sure you have the Shiny package (if not,
install.packages('shiny')
) - Issue the runApp() command (note that the latest RStudio, v.0.98.932, has new commands to launch directly ShinyApps)
- From there, just interact with the Volcano using the inputs located in the left panel