Message Boards Message Boards

[Reddit-DiBB0118] Interspecies comparison using RadarChart

Posted 6 years ago

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


enter image description here

Intro

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

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

Details

Let's bring the data in first.

raw = Drop[(Import["http://aquatext.com/tables/algaegrwth.htm", "Data"] /.  "0..06" ->  0.06)[[2]]
      /. {"Temperature", ___} -> {"Temperature", 5, 5, 10, 10, 25, 25, 30, 30}, {3}];
data = raw[[3 ;;, 2 ;;]];

The first question I want to answer is: are there similarities in response across the different species? Let's take advantage of the ClusterClassify functionality from the wolfram language.

c = ClusterClassify[data, PerformanceGoal -> "Quality"];
clusters = c[data]
(*{2, 1, 1, 4, 1, 1, 1, 2, 2, 1, 5, 4, 3, 1, 1, 1, 1, 3, 2}*)

Five clusters were identified by the ClassifierFunction. Let us visually compare the five clusters to see how the algorithms has grouped the different species together. We'll be utilizing the Radar Chart Package.

clusters = Flatten[Position[clusters, #]] & /@ Range[5];
{min, max} = Through[{Min, Max}[data]];
temperature = raw[[1, 2 ;;]];
lux = raw[[2, 2 ;;]];
axesLabel = 
 Flatten@Outer[
   Style[ToString[#1] <> "\[Degree]C / " <> ToString[#2] <> " lux"] &,
    Union@temperature, Union@lux];
clusterSpecies = raw[[# + 2, 1]] & /@ clusters;
<< RadarChart`
RadarChart[Rescale[data[[clusters[[#]]]], {min, max}], 
    Filling -> Axis, AxesLabel -> axesLabel, ImageSize -> Large, 
    ChartLegends -> clusterSpecies[[#]]] & /@ Range[5]

enter image description here

The clustering does a good job in identifying species that respond in a similar maner to the different experiments. We'll use the clustering to group the different species in the final charts.

labelColors = {Black, Blue, Red, Purple, Darker@Green};
axesSpecies = 
  Flatten[Table[
    Style[StringReplace[#, " " -> "\n"], labelColors[[n]]] & /@ 
     clusterSpecies[[n]], {n, 5}]];
algae = Flatten[
  Table[{raw[[i + 2, 1]], temperature[[j]], lux[[j]], 
    raw[[i + 2, j + 1]]}, {i, Flatten@clusters}, {j, Length@lux}], 1];
myChart[temp_, lux_] := 
 Cases[algae, {_, temp, lux, v_} -> Rescale[v, {min, max}]]
ticks = Round[Rescale[Range[-0.5, 1.5, 0.5], {min, max}], 0.01];
ruleTicks = 
  With[{x = Style[ToString@#] & /@ ticks, 
    y = Style[#, Darker@Gray] & /@ {"-0.5", "0.0", "0.5", "1.0", 
       "1.5"}}, Thread[Rule[x, y]]];
Grid[Partition[
   Table[RadarChart[Table[myChart[i, j], {j, Union@lux}], 
     Filling -> Axis, AxesLabel -> axesSpecies, ImageSize -> 500, 
     PlotStyle -> {Blue, Red}, ChartLegends -> None, 
     AxesType -> "Star", FrameTicks -> ticks, 
     PlotLabel -> 
      Style["Temperature " <> ToString[i] <> " C\n", Bold, 
       FontSize -> 15], 
     Epilog -> {Darker@Gray, Circle[{0, 0}, ticks[[2]]], Dashed, 
       Circle[{0, 0}, #] & /@ Drop[ticks, {2}],}], {i, 
     Union@temperature}], 2], Frame -> All, 
  FrameStyle -> Gray] /. ruleTicks

enter image description here

POSTED BY: Diego Zviovich

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/1260507

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

POSTED BY: Moderation Team
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