Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erblast/parcats
htmlwidget that creates plotly parallel categories diagrams from easyalluvial plots.
https://github.com/erblast/parcats
Last synced: about 2 months ago
JSON representation
htmlwidget that creates plotly parallel categories diagrams from easyalluvial plots.
- Host: GitHub
- URL: https://github.com/erblast/parcats
- Owner: erblast
- License: other
- Created: 2019-10-15T20:53:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-11T08:34:15.000Z (about 1 year ago)
- Last Synced: 2024-12-09T23:33:42.493Z (2 months ago)
- Language: R
- Homepage: https://erblast.github.io/parcats/
- Size: 5.7 MB
- Stars: 25
- Watchers: 2
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- awesome-r-dataviz - parcats - htmlwidget that creates plotly parallel categories diagrams from easyalluvial plots. (ggplot / Miscellaneous)
README
---
output: github_document
always_allow_html: no
editor_options:
chunk_output_type: console
---```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
warning = FALSE,
fig.path = "man/figures/README-"
)
```[![Codecov test coverage](https://codecov.io/gh/erblast/parcats/branch/master/graph/badge.svg)](https://app.codecov.io/gh/erblast/parcats?branch=master)
[![CRAN status](https://www.r-pkg.org/badges/version/parcats)](https://CRAN.R-project.org/package=parcats)
[![CRAN_time_from_release](https://www.r-pkg.org/badges/ago/parcats)](https://cran.r-project.org/package=parcats)
[![metacran downloads](https://cranlogs.r-pkg.org/badges/grand-total/parcats)](https://cran.r-project.org/package=parcats)
[![metacran downloads](https://cranlogs.r-pkg.org/badges/parcats)](https://cran.r-project.org/package=parcats)
[![R build status](https://github.com/erblast/parcats/workflows/R-CMD-check/badge.svg)](https://github.com/erblast/parcats/actions)###### Create 'plotly.js' Parallel Categories Diagrams Using this Htmlwidget and 'easyalluvial'
Complex graphical representations of data are best explored using interactive elements.
'parcats' adds interactive graphing capabilities to the 'easyalluvial' package.
The 'plotly.js' parallel categories diagrams offer a good framework for
creating interactive flow graphs that allow manual drag and drop sorting of dimensions
and categories, highlighting single flows and displaying mouse over information. The
'plotly.js' dependency is quite heavy and therefore is outsourced into a separate package.## Installation
### CRAN
```{r cran, eval = FALSE }
install.packages('parcats')
```### Development Version
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("erblast/parcats")
```## easyalluvial
`parcats` requires an alluvial plot created with `easyalluvial` to create an interactive parrallel categories diagram.
- [easyalluvial documentation](https://erblast.github.io/easyalluvial/)
- [easyalluvial github page](https://github.com/erblast/easyalluvial)
## Examples
```{r}
suppressPackageStartupMessages(require(tidyverse))
suppressPackageStartupMessages(require(easyalluvial))
suppressPackageStartupMessages(require(parcats))
```### Shiny Demo
The shiny demo allows you to interactively explore the parameters of `alluvial_wide()` and `parcats()`
```{r eval = FALSE}
parcats_demo()
```### Live Widget
The Htmlwidgets cannot be embedded in the `README.md` file. Check out the [Live Widget here](https://erblast.github.io/parcats/articles/parcats.html).
### Parcats from alluvial from data in wide format
```{r eval = FALSE}
p <- alluvial_wide(mtcars2, max_variables = 5)parcats(p, marginal_histograms = TRUE, data_input = mtcars2)
```
![](https://raw.githubusercontent.com/erblast/parcats/master/man/figures/demo1.gif)
### Parcats from model response alluvial
Machine Learning models operate in a multidimensional space and their response is hard to visualise. Model response and partial dependency plots attempt to visualise ML models in a two dimensional space. Using alluvial plots or parrallel categories diagrams we can increase the number of dimensions.
- [Visualise model response with alluvial plots](https://www.datisticsblog.com/2019/04/visualising-model-response-with-easyalluvial/)
Here we see the response of a random forest model if we vary the three variables with the highest importance while keeping all other features at their median/mode value.
```{r eval = FALSE}
df <- select(mtcars2, -ids )
m <- randomForest::randomForest( disp ~ ., df)
imp <- m$importance
dspace <- get_data_space(df, imp, degree = 3)
pred <- predict(m, newdata = dspace)
p <- alluvial_model_response(pred, dspace, imp, degree = 3)parcats(p, marginal_histograms = TRUE, imp = TRUE, data_input = df)
```
![](https://raw.githubusercontent.com/erblast/parcats/master/man/figures/demo2.gif)