rugplot: Heatmaps
Contents
rugplot: Heatmaps#
A heatmap is typically a rectangular tiling of a color-shaded data
matrix. Additionally, this technique is one of the most
space-efficient ways to visualize data. Here some examples are given
to show how to create heatmaps using the rugplot
container. The
exergaming dataset from Soancatl-Aguilar et al. [SAvandGrondeL+17] will be used
to create such examples. The dataset can be downloaded by running the
following command
wget https://raw.githubusercontent.com/rijksuniversiteit-groningen/rugplot/master/tests/testthat/data/exergamelf2.csv
Invoke-WebRequest https://raw.githubusercontent.com/rijksuniversiteit-groningen/rugplot/master/tests/testthat/data/exergamelf2.csv -OutFile exergamelf2.csv
or by adding the link in the previous command to the JSON template that will be created in the second step to create the heatmap.
Creating a heatmap using the rugplot
container#
For simplicity it is better to create an alias
, see the
Docker commands section.
Step 1, create a rugplot histogram template
rugplot template -p heatmap
docker run --rm -v "$PWD":/app/data -u $(id -u):$(id -g) venustiano/rugplot:0.1.0 \ template -p heatmap
docker run --rm -v ${PWD}:/app/data venustiano/rugplot:0.1.0 ` template -p heatmap
A
heatmap_params.json
file will be created including some of the name/value pairs listed below:{ "description": "Parameters to create a heatmap plot using the 'rugplot' R package", "filename": "<filename path>", "method": "raster", "aesthetics": { "y_variable": "<Y required column name>", "x_variable": "<X required column name>", "fill": "<required variable>", }, }
Step 2, adding
'data file'
,'x, y and fill variables'
, and somesave
properties:{ "filename": "exergamelf2.csv", "aesthetics": { "y_variable": "myVars", "x_variable": "idrow", "fill": "normVal", }, "save": { "save": true, "outputfilename": "exergaming_heatmap", "width": 17, "height": 7, "dpi": 300, "device": "png", } }
Step 3, create the heatmap
rugplot plot -p heatmap --file heatmap_params.json
docker run --rm -v "$PWD":/app/data -u $(id -u):$(id -g) venustiano/rugplot:0.1.0 \ plot -p heatmap --file heatmap_params.json
docker run --rm -v ${PWD}:/app/data venustiano/rugplot:0.1.0 ` plot -p heatmap --file heatmap_params.json
The result will be stored in the
exergamin_heatmap.png
file.Step 4, customizing color, label and LaTeX format
{ "labels": { "x": "Trials per participant", "y": "Balance measures", "fill": "Normalized\nmeasures", }, "colour_scales": { "fill_gradient": { "method": "gradient", "low": "#fee0d2", "high": "#67000d", } }, "axes_scales": { "y_discrete": { "labels": ["medTIms51 = I`", "medTI51 = I", "medSpeed = Speed", "medLsdD51 = SD`", "medLsd51 = SD", "medLrmslD51 = RMS`", "medLrms51 = RMS", "medLcovD51 = CoV`", "medLcov51 = CoV", "medK = $\\\\kappa$", "meanK = $\\\\overline{\\\\kappa}$"] } }, "save": { "device": "tikz", "sanitize": false } }
References#
- SAvandGrondeL+17
Venustiano Soancatl-Aguilar, Jasper J. van de Gronde, Claudine J. C. Lamoth, Mike van Diest, Natasha M. Maurits, and Jos B. T. M. Roerdink. Visual data exploration for balance quantification in real-time during exergaming. PLOS-One, January 2017. doi:10.1371/journal.pone.0170906.