knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
galahr provides a GUI to the tourr
package based on shiny
and plotly
. Upload your dataset and use the input panel to select settings for the tour and display, move to the results panel to play the tour animation.
Launch the GUI with the default dataset as
launchApp()
This will build a Shiny app with some initial default settings, the parameters can then be modified via the graphical interface inside the app. Note that the GUI has two separate tabs, "input"" and "results"", and the "Update results"" action button must be pressed before the results are updated with new input selections. This is because some options may result in long running times before the results can be updated (in particular recording a guided tour).
To look at a different dataset you can either use the file upload in the "input" panel after launching the app, or pass your dataframe in the function call. For example you can launch using the GW170817
data as
launchApp(paramDF = GW170817)
Go through the examples below to get an overview of how to use the interface in different ways.
tsfeatureData
By default the tsfeatureData
dataset is loaded when calling launchApp()
. This data set contains features (calculated with the tsfeatures
package) for three types of time series,^[taken from https://www.comp-engine.org] the type is stored in the category
variable. By default the app will start up with a grand tour shown in the density display, and up to six variables are selected. You can change the display type as follows
You should see something like this:
knitr::include_graphics('./tsExample.png')
galah
Another example dataset included with this package is galah
. Below we explain the steps for viewing a planned tour path with this dataset
m1 <- basisMatrix(1,2,6) m2 <- basisMatrix(3,4,6) m3 <- basisMatrix(5,6,6)
galahPath <- list(m3, m1, m2, m3)
saveRDS(galahPath, file="galahPath.rds")
- now lauch the app with the `galah` dataset
r
launchApp(galah)
```
- select the "groups" display as in the previous example (note that here the categorical variable contains hex codes which are directly mapped to color in the "results" display)
- select the tour type to be "Planned tour"
- this will enable a file upload for the tour path, upload the previously saved "galahPath.rds"
- update the results by pressing "update results"
- move to the "results" panel and hit "Play" to view the planned tour of the dataset
The first view should look like this:
knitr::include_graphics('./galahExample.png')
GW170817
The third dataset included with the package is a posterior sample fitting neutron star parameters to the observed gravitational wave event GW170817.^[see https://doi.org/10.1103/PhysRevLett.119.161101] We will use this dataset to demonstrate using: density displays, guided tour, local tour and linked brushing.
r
launchApp(GW170817)
Using the density display
Using the guided tour
mbgraphic
installed, try the "splines2d" indexUsing the local tour and linked brushing
The example below was made in the linked brushing display, selecting points with low values of R2 on the 1-d display.
knitr::include_graphics('./gwExample.png')
The default input options are shown in the annotated image below.
knitr::include_graphics('./input_annotated.png')
The following options are available:
| Option | Details | |:--|:---------| | Input update | Click "Browse" to upload CSV file of your input data | | Parameter selection | Check the parameters that should be included in the tour (at least 3) | | Rescale | Check to rescale each parameter direction to take values between 0 and 1 | | Tour type | Select from grand tour, guided tour, planned tour, little tour and local tour (starting from the current basis, this is particularly useful when stopping the tour display and loading a local tour to explore the surroundings of an identified interesting view)| | Step size | Fix the angular step size used in the interpolation between anchor planes | | Display type | Choose from density, groups and linked brushing | | Update results | Push button to update results with new input selection |
In addition, some settings allow for new options:
| Option | Details |
|:--|:---------|
| Index function | Choose index function used in the guided tour. The tourr
functions holes
and cmass
are always available. If the binostics
package is installed the scagnostics indexes "Skinny", "Striated", "Convex" and "Clumpy" are available. If the mbgraphic
package is installed the index functions "splines2d" and "dcor2d" are available, and if the minerva
package is installed the index functions "MIC" and "TIC" are available. In addition, if grouping is selected "lda_pp" and "pda_pp" from the tourr
package are also available.|
| Anchor planes | Upload the anchor planes for a planned tour in RDS format. |
| Grouping variable | Select a grouping variable from all character type input parameters, this is mapped to color in the groups display. |
An annotated example of the results display is shown below.
knitr::include_graphics('./results_annotated.png')
The following options are available (some depend on display type):
| Option | Details | |:--|:---------| | Play | Press to start/pause the tour animation | | Save/Print| Save (in RDS format) or print the projection matrix for the currently shown projection | | Save all | Save all anchor planes of the current tour path (in RDS format) | | Alpha | Select transparancy of points in the density display | | Update as | Choose how selection for linked brushing is updated (use only new selection, combine both or use only the overlapping region) | | Selected points only | Only show selected points in the linked brushing display | | Sample size | Fix a size for a random sample used in the tour display, this may be required for large data sets if rendering becomes slow |
The results are shown in five displays:
| Display | Details | |:--|:---------| | Axes display | Visualisation of the currently shown projection matrix. | | Coverage display | Visualisation of the coverage of the current tour path in the space of all projections based on principal component analysis, anchor points (spanning the basis in p dimensions) are shown in purple, the tour path basis vectors shown in green and the current position shown in black. | | Tour display | Visualisation of the projected data points in the form of a 2-d scatter plot. In addition we also show a projection of the hypercube containing all data points. | | Timeline display | Points in red indicate anchor points selected by the tour path generator. The black point shows the current position along the timeline. When the animation is paused clicking on the timeline will result in jumping to the corresponding projection. | | 1-d parameter display | Visualising the parameter values of all data points, this is most useful when working with the linked brushing option. |
Thanks to Nick Tierney for reviewing this package and giving lots of helpful feedback!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.