Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider a4268ba5 rédigé par Eric LANGUENOU's avatar Eric LANGUENOU
Parcourir les fichiers

Initial commit

parent
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
---
title: "ImportanceDrivenColorAssign"
output:
html_document:
keep_md: true
md_document:
variant: markdown_github
---
<br />
<br />
![](streamgraphAssignmentExample.png "Streamgraph")
<br />
### DESCRIPTION
ImportanceDrivenColorAssign is a "proof of concept" for a color-group assignment optimizer driven by contrast in the case of categorical visualizations. The algorithm takes data and a color map as input and try to assign the colors to the data categories while maximizing color contrast between categories.
Applications of the method to **streamgraph, chord-diagram, line graphs, pie chart** are shown in the package.
Principles of the concept are explained in a research report available on [HAL repository](https://hal.archives-ouvertes.fr/hal-03685074).
In this research, a "good" color-group assignment is expressed via two symmetrical matrices:
1. the **color distance matrix**, which contains the DE2000 (also called CIEDE200) ([Wikipedia](https://en.wikipedia.org/wiki/Color_difference)) color distance between colors (implemented in R package [Farver](https://www.rdocumentation.org/packages/farver/versions/2.1.1)). This matrix is not dependent on the visualization diagram geometry.
2. the **"importance" matrix** which contains for groups couple the importance to assign contrasted colors to categories couple using the geometry of the displayed graphic items (neighboring, dimensions). This matrix is not dependent on the colormap.
The score for a given permutation is then evaluated by the inner matrix product (also known as Frobenius product) of the two previous matrices where elements of the color matrix have been permuted according to the evaluated permutation.
A genetic optimizer for which mutation and cross-reproduction are specialized to handle permutation search, is then used (R package [GA](https://www.rdocumentation.org/packages/GA/versions/3.2.2)).
The author ([Link to personal webpage](http://www.ericlanguenou.fr/en)) is assistant professor at Nantes University in France and is a member of the "DUKe" team of the [LS2N](https://www.ls2n.fr/?lang=en) computer science research laboratory.
The author would like to thank the R community for kindly responding to newbies, Yan Holtz ([data-to-viz](https://www.data-to-viz.com/)) for providing the chord-diagram R code and Prof. Pascale Kuntz for her support.
### PACKAGE
The package contains the following R6 classes:
- ColorLayerAssignmentOptimizer: handling the genetic optimization
- PolygonMapsImportance : handling polygonal maps importance matrix computation
- ImportanceForStreamgraphs: streamgraph importance matrix computation
- ImportanceForLineGraphs: line graphs
- SimpleNeighborDiagramImportance: to handle bar charts and pie diagrams
### DEMOS
Files showing how to use the various R6 classes are listed in the directory "Examples".
### DOCUMENTATION
Public R6 classes methods of the package are documented (though parameter types are not listed). R6 classes private methods cannot be documented in the R classic way, therefore their doc parts are indicated but commented in the source code.
### QUALITY OF R CODE
The author would like to emphasis that he only has spent a few months on R language. Experienced R users will certainly be horrified by the way methods are coded, which are certainly not in the R style, neither respecting naming conventions. Just remember that it is just a functional proof of concept.
Please fill free to fork (with proper credits).
### FUTURE
The author hopes that other/better diagram dependent "importance" matrix formulas will be experimented and compared by the community.
Extensions on other categorical visualizations could handle:
- Indirect chord diagrams,
- other layers ordering for streamgraphs,
- Sankey diagrams and alluvial diagrams.
- A better importance matrix evaluation for polygonal maps. It is currently implemented as the maximum of the inverse of the two areas, and it should take into account the perpendicular thickness of the two polygons along the frontier (which the author has tested in java, providing thus better results).
The author won't develop further applications of this concept in R language.
### Installation
The devtools package provides install_github() that enables installing packages from GitHub.
```r
devtools::install_github("ericlanguenou/ImportanceDrivenColorAssign")
```
### Usage
See "Examples" directory on github.
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter