Message Boards Message Boards

[Reddit-DiBB0118] Interspecies comparison using HeatmapPlot

Posted 7 years ago

Click on the image to zoom. Then click your browser back button to return to reading the post.


enter image description here

Introduction

This post is a response to the [CALL] Reddit DataViz Battle JAN2018: Visualize the Growth Rates of Algae:

http://community.wolfram.com/groups/-/m/t/1257547

Get the package

This command loads the package HeatmapPlot.m (proclaimed first in "The Great conversation of USA presidential speeches"):

Import["https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/Misc/HeatmapPlot.m"]

Get the data

raw = Import["http://aquatext.com/tables/algaegrwth.htm", "Data"] /. "0..06" -> .06;    
data = Cases[raw, {_String, __?NumberQ}, Infinity] /. x_List /; First[x] == "Temperature" :> {"Temperature", 5, 5, 10, 10, 25, 25, 30, 30};

(Using the code given in the request post.)

Plot

This sorts data columns according to {lux,temperature}:

sdata = MapThread[ Prepend, {Transpose[SortBy[Transpose[Rest /@ data], {#[[2]], #[[1]]} &]], First /@ data}];

TableForm[sdata]

enter image description here

This heat-map plot has a dendrogram made by hierarchical clustering of the species:

HeatmapPlot[Rest /@ sdata[[3 ;; -1]], 
  First /@ sdata[[3 ;; -1]], 
  Map[Row[{"temp:", Style[#[[1]], Bold, Purple], ", lux:", Style[#[[2]], Bold, Purple]}] &, Transpose[Rest /@ sdata[[1 ;; 2]]]], 
  DistanceFunction -> {EuclideanDistance, None}, 
  Dendrogram -> {True, False}, ImageSize -> 500]

enter image description here

Alternative plot

Here is an alternative, double-dendrogram plot:

HeatmapPlot[Transpose[Rest /@ sdata[[3 ;; -1]]], 
 Map[Row[{"temp:", Style[#[[1]], Bold, Purple], ", lux:", Style[#[[2]], Bold, Purple]}] &, Transpose[Rest /@ sdata[[1 ;; 2]]]], 
 First /@ sdata[[3 ;; -1]],
 DistanceFunction -> {EuclideanDistance, EuclideanDistance}, 
 Dendrogram -> {True, True}, ImageSize -> 1000]

enter image description here

POSTED BY: Anton Antonov

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming!

If you wish you now can submit your post to Reddit competition simply by entering your post link:

http://community.wolfram.com/groups/-/m/t/1261444

in a comment here: https://redd.it/7nm6ed

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract