7
|
11330 Views
|
|
7 Total Likes
View groups...
Share
GROUPS:

# [Reddit-DiBB0118] Interspecies comparison using RadarChart

Posted 7 years ago

## 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;
Filling -> Axis, AxesLabel -> axesLabel, ImageSize -> Large,
ChartLegends -> clusterSpecies[[#]]] & /@ Range[5]


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",
Grid[Partition[
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
`