--- title: "Usage example" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Usage example} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- <script> function setState(state) { document.getElementById('myWidget').langevitour.setState(state); } </script> ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` As an example we will use measurements of penguins made at Palmer Station, Antarctica. Since the measurements are in different units, we supply an appropriate scaling. ```{r} library(langevitour) library(palmerpenguins) completePenguins <- na.omit(penguins[,c(1,3,4,5,6)]) completePenguins scale <- apply(completePenguins[,-1], 2, sd)*4 langevitour( completePenguins[,-1], completePenguins$species, scale=scale, pointSize=2, elementId="myWidget") ``` <br> **Things to try:** <div style="display: grid; grid-template-columns: 50% 50%; column-gap: 1em; row-gap: 1em; margin: 0 0 2em 4em;"> <div>Drag labels onto the plot.</div> <div><button onclick="setState({labelPos:{'Adelie':[-0.6553191489361703,0.7595744680851064],'Chinstrap':[-0.5957446808510638,-0.7723404255319148],'Gentoo':[0.7829787234042553,0.06595744680851068]}})">Example</button> <button onclick="setState({labelPos:{}})">Clear</button></div> <div>Turn on a guide.</div> <div><button onclick="setState({pointRepulsionType:'pca'})">PCA</button> <button onclick="setState({guideType:'none'})">None</button></div> <div>Experiment with "damping" and "heat" in the hamburger menu.</div> <div> <button onclick="setState({damping:2,heat:1})">Twitchy</button> <button onclick="setState({damping:-2,heat:0})">Smooth</button> <button onclick="setState({damping:0,heat:3})">Hot</button> <button onclick="setState({damping:0,heat:-3})">Cool</button> <button onclick="setState({damping:0,heat:0})">Default</button> </div> <div>When only three measurements are shown, your eyes will interpret the display as 3D. Hide measurements by unchecking the checkbox on their label.</div> <div> <button onclick="setState({labelInactive:['bill_length_mm']})">Hide bill length</button> <button onclick="setState({labelInactive:[]})">Show all</button> </div> </div> # Further examples Some further examples have been omitted from the CRAN package due to their large size and problematic dependencies. They can be viewed on the langevitour website: * [Further examples](https://logarithmic.net/langevitour/articles/examples.html) * [RNA-Seq extended example](https://logarithmic.net/langevitour/articles/rnaseq.html)