Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Hi I have a simple question. How do I plot the following with Day 1 as my X axis and Day 2 as my Y axis? I need the 22 variances plotted according to the Day they were taken from (these were originally 3D measurements taken over 2 days with the same specimens each day, there were 11 specimens and 22 xyz measurements from which I have taken the variances).

Can someone kindly help me out? I can't even find Scatterplot listed in Mathematica docs, do they call it something else?

{{{"ID", "Day", 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 
13., 14., 15., 16., 17., 18., 19., 20., 21., 22.}, {"H. sapiens", 
1., 145.7, 153.2, 164.6, 161.1, 170.8, 191.7, 179.2, 178.5, 198.5, 
169.9, 135.8, 182.8, 205.3, 210.3, 197.3, 238.4, 207.4, 209., 
188.6, 201.3, 210.2, 206.9}, {"H. sapiens", 2., 146.8, 152.7, 
165.6, 165.1, 172.4, 189.2, 179.2, 193.9, 199.7, 172.9, 136.1, 
181.8, 204.3, 212.3, 197.4, 238., 205.7, 211.5, 191.5, 204.3, 
218.2, 204.2}, {"Pan troglodytes", 
1., -200.9, -230.2, -205.5, -238.8, -237.3, -207.1, -213.2, \
-221.6, -225.9, -247.1, -242.6, -266.5, -259.1, -258., -266.1, -259., \
-227.3, -228.9, -212.1, -213.6, -223.9, -225.1}, {"Pan troglodytes", 
2., -199.4, -229.6, -203.5, -243.6, -238.6, -205.7, -213.1, \
-222.3, -227.3, -258.1, -242.9, -265.4, -265.1, -258., -269.9, -260., \
-228.2, -233.3, -212.3, -215.1, -225.4, -223.6}, {"Pan verus ", 1., 
261.2, 273., 274., 283., 285.06, 300., 294., 305.037, 315.33, 
289.08, 263.6, 298.46, 306.3, 316.7, 306.5, 331.6, 320.81, 323.7, 
298.13, 312.79, 319.2, 310.2}, {"Pan verus", 2., 264.1, 268.7, 
273.1, 289.19, 288.03, 299.9, 291.9, 304.137, 316.54, 289.675, 
263.4, 298.58, 309.3, 316.2, 306., 332.3, 323.31, 327.4, 297.26, 
310.95, 321.8, 310.9}, {"Pan schweinfurthii ", 1., 230.6, 241.2, 
241., 257.3, 253.3, 274.1, 265.9, 272.36, 280.147, 259.21, 229.8, 
268.19, 277.62, 286.6, 275.56, 306.3, 287.4, 292.04, 270.36, 
283.35, 291.3, 281.13}, {"Pan schweinfurthii ", 2., 226.9, 237.9, 
239.9, 254.6, 257., 273.7, 262., 273.33, 282.84, 260.05, 229.6, 
267.49, 278.23, 287.9, 272.72, 306.2, 287.58, 287.92, 270.85, 
283.37, 292.3, 281.88}, {"Pan paniscus ", 
1., -421.9, -447., -420.9, -454.5, -451.7, -419.8, -427.8, -431.9, \
-445.7, -463.4, -459.2, -476.3, -470.1, -466.5, -475.5, -450.1, \
-439.5, -445.8, -417.4, -419.5, -434.4, -432.2}, {"Pan paniscus", 
2., -426.2, -447.9, -421.5, -455.6, -453., -420.4, -428.7, -432.7, \
-441.5, -466.8, -459.5, -476.4, -470.9, -467.2, -474.7, -472.5, \
 -437.5, -446.9, -416.4, -424.7, -433.1, -437.}, {"G. gorilla ", 
1., -175.9, -204., -175.1, -221., -217., -168., -187., -198., \
-213., -229., -220.8, -251.8, -251., -245., -256., -243., -211., \
-224., -190., -194., -210., -212.}, {"G. gorilla ", 2., -180.8, -205.,
214.1, -228., -223., -167., -191., -195., -206., -242.9, -221.6, \
-251.8, -253., -243., -256., -243., -211., -224., -189.8, -196., \
-210., -215.}, {"G. graueri ", 1., 220., 192., 222., 177., 184., 228.,
214., 205., 187., 162., 174., 147., 155., 162., 145., 170., 194., 
186., 221.2, 215.5, 198.8, 198.3}, {"G. graueri ", 2., 221., 189., 
226., 182., 179., 230., 214., 210., 188., 161., 172., 146., 153., 
156., 146., 169., 193., 189., 221.2, 220.6, 202.2, 
196.9}, {"G. beringei", 
1., -763., -793.5, -762.2, -810.3, -802., -749.7, -771., -777., \
-783., -828., -809.3, -836.9, -833., -828., -837.9, -809., -788., \
-795., -767.3, -768.4, -789., -782.8}, {"G. beringei", 
2., -763.3, -791.9, -761.3, -805.6, -800., -748.5, -769., -776., \
-774., -817.4, -812.8, -836.4, -833., -825., -837.2, -820., -791., \
-797., -766.6, -769.8, -782.6, -786.3}, {"G. diehli", 
1., -78., -106.4, -77., -124., -121., -72.4, -87.5, -94., -99., \
-134., -122.1, -149., -153., -141., -154., -137., -105., -111., -83., \
-87., -104., -105.}, {"G. diehli", 
2., -79.6, -105.8, -77., -124., -119., -72.1, -86., -100., -99., \
-134., -121.5, -148., -152., -142., -152., -135., -104., -110., \
-84.7, -86., -103., -107.}, {"P. abelii ", 
1., -214.09, -232.6, -209.24, -232.56, -227.49, -185.5, -204.5, \
-209.5, -213.9, -250.52, -249.8, -256.49, -249.85, -244.22, -257.96, \
-237.6, -219.2, -225.2, -198.8, -201.9, -223.3, -224.2}, {"P. abelii \
", 2., -214.93, -230.8, -209.97, -233.98, -230.51, -184.4, -204.4, \
-208.4, -214.1, -249.21, -250., -258.98, -250.1, -242., -256.86, \
-234.5, -225.9, -226.4, -201., -205.8, -225.1, -224.1}, {"P. \
pygmaeus", 
 1., -288.8, -280.5, -280.5, -265., -264., -238.5, -250.7, -234.2, \
-224.9, -258.9, -296.1, -259.5, -246.3, -234.5, -251.1, -212.5, \
-224.5, -219.6, -249.1, -230.4, -224.4, -233.}, {"P. pygmaeus", 
 2., -293.5, -284.3, -278.4, -256.8, -255.6, -236.3, -248.4, \
-233.4, -227.3, -261.4, -295.5, -262., -242.6, -233.8, -252.2, -212., \
-225.1, -220.3, -248.2, -230.9, -225.3, -233.7}}}
share|improve this question

2 Answers 2

Significant manual cleaning was required for block of data in post.

The data:

data = {{{"ID", "Day", 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 
     12., 13., 14., 15., 16., 17., 18., 19., 20., 21., 
     22.}, {"H. sapiens", 1., 145.7, 153.2, 164.6, 161.1, 170.8, 
     191.7, 179.2, 178.5, 198.5, 169.9, 135.8, 182.8, 205.3, 210.3, 
     197.3, 238.4, 207.4, 209., 188.6, 201.3, 210.2, 
     206.9}, {"H. sapiens", 2., 146.8, 152.7, 165.6, 165.1, 172.4, 
     189.2, 179.2, 193.9, 199.7, 172.9, 136.1, 181.8, 204.3, 212.3, 
     197.4, 238., 205.7, 211.5, 191.5, 204.3, 218.2, 
     204.2}, {"Pan troglodytes", 
     1., -200.9, -230.2, -205.5, -238.8, -237.3, -207.1, -213.2, \
-221.6, -225.9, -247.1, -242.6, -266.5, -259.1, -258., -266.1, -259., \
 -227.3, -228.9, -212.1, -213.6, -223.9, -225.1}, {"Pan troglodytes", 
     2., -199.4, -229.6, -203.5, -243.6, -238.6, -205.7, -213.1, \
-222.3, -227.3, -258.1, -242.9, -265.4, -265.1, -258., -269.9, -260., \
 -228.2, -233.3, -212.3, -215.1, -225.4, -223.6}, {"Pan verus", 1., 
     261.2, 273., 274., 283., 285.06, 300., 294., 305.037, 315.33, 
     289.08, 263.6, 298.46, 306.3, 316.7, 306.5, 331.6, 320.81, 323.7,
      298.13, 312.79, 319.2, 310.2}, {"Pan verus", 2., 264.1, 268.7, 
     273.1, 289.19, 288.03, 299.9, 291.9, 304.137, 316.54, 289.675, 
     263.4, 298.58, 309.3, 316.2, 306., 332.3, 323.31, 327.4, 297.26, 
     310.95, 321.8, 310.9}, {"Pan schweinfurthii ", 1., 230.6, 241.2, 
     241., 257.3, 253.3, 274.1, 265.9, 272.36, 280.147, 259.21, 229.8,
      268.19, 277.62, 286.6, 275.56, 306.3, 287.4, 292.04, 270.36, 
     283.35, 291.3, 281.13}, {"Pan schweinfurthii ", 2., 226.9, 237.9,
      239.9, 254.6, 257., 273.7, 262., 273.33, 282.84, 260.05, 229.6, 
     267.49, 278.23, 287.9, 272.72, 306.2, 287.58, 287.92, 270.85, 
     283.37, 292.3, 281.88}, {"Pan paniscus", 
     1., -421.9, -447., -420.9, -454.5, -451.7, -419.8, -427.8, \
-431.9, -445.7, -463.4, -459.2, -476.3, -470.1, -466.5, -475.5, \
-450.1, -439.5, -445.8, -417.4, -419.5, -434.4, -432.2}, {"Pan \
paniscus", 
     2., -426.2, -447.9, -421.5, -455.6, -453., -420.4, -428.7, \
-432.7, -441.5, -466.8, -459.5, -476.4, -470.9, -467.2, -474.7, \
-472.5, -437.5, -446.9, -416.4, -424.7, -433.1, -437.}, {"G. gorilla \
", 1., -175.9, -204., -175.1, -221., -217., -168., -187., -198., \
-213., -229., -220.8, -251.8, -251., -245., -256., -243., -211., \
-224., -190., -194., -210., -212.}, {"G. gorilla ", 2., -180.8, -205.,
      214.1, -228., -223., -167., -191., -195., -206., -242.9, \
-221.6, -251.8, -253., -243., -256., -243., -211., -224., -189.8, \
-196., -210., -215.}, {"G. graueri ", 1., 220., 192., 222., 177., 
     184., 228., 214., 205., 187., 162., 174., 147., 155., 162., 145.,
      170., 194., 186., 221.2, 215.5, 198.8, 198.3}, {"G. graueri ", 
     2., 221., 189., 226., 182., 179., 230., 214., 210., 188., 161., 
     172., 146., 153., 156., 146., 169., 193., 189., 221.2, 220.6, 
     202.2, 196.9}, {"G. beringei", 
     1., -763., -793.5, -762.2, -810.3, -802., -749.7, -771., -777.,  \
-783., -828., -809.3, -836.9, -833., -828., -837.9, -809., -788., \
-795., -767.3, -768.4, -789., -782.8}, {"G. beringei", 
     2., -763.3, -791.9, -761.3, -805.6, -800., -748.5, -769., -776., \
 -774., -817.4, -812.8, -836.4, -833., -825., -837.2, -820., -791.,  \
-797., -766.6, -769.8, -782.6, -786.3}, {"G. diehli", 
     1., -78., -106.4, -77., -124., -121., -72.4, -87.5, -94., -99.,  \
-134., -122.1, -149., -153., -141., -154., -137., -105., -111., -83., \
 -87., -104., -105.}, {"G. diehli", 
     2., -79.6, -105.8, -77., -124., -119., -72.1, -86., -100., -99., \
 -134., -121.5, -148., -152., -142., -152., -135., -104., -110.,  \
-84.7, -86., -103., -107.}, {"P. abelii ", 
     1., -214.09, -232.6, -209.24, -232.56, -227.49, -185.5, -204.5,  \
-209.5, -213.9, -250.52, -249.8, -256.49, -249.85, -244.22, -257.96,  \
-237.6, -219.2, -225.2, -198.8, -201.9, -223.3, -224.2}, {"P. abelii \
", 2., -214.93, -230.8, -209.97, -233.98, -230.51, -184.4, -204.4,  \
-208.4, -214.1, -249.21, -250., -258.98, -250.1, -242., -256.86,  \
-234.5, -225.9, -226.4, -201., -205.8, -225.1, -224.1}, {"P. \
pygmaeus", 
     1., -288.8, -280.5, -280.5, -265., -264., -238.5, -250.7, \
-234.2,  -224.9, -258.9, -296.1, -259.5, -246.3, -234.5, -251.1, \
-212.5, -224.5, -219.6, -249.1, -230.4, -224.4, -233.}, {"P. \
pygmaeus", 
     2., -293.5, -284.3, -278.4, -256.8, -255.6, -236.3, -248.4, \
-233.4, -227.3, -261.4, -295.5, -262., -242.6, -233.8, -252.2, -212., \
 -225.1, -220.3, -248.2, -230.9, -225.3, -233.7}}};

If I interpret correctly: there are 11 species with data from 2 days (11 replications). The OP suggests the data recorded are "variances" (there are 22 values per sepcies) and the OP states "from which I have taken the variance". However, variance should be non-negative.

The following plots "day 2" against "day 1" by species. This may not be desired output.

dat = Rest@data[[1]];
spec = dat[[All, 1]];
datm = #[[3 ;;]] & /@ (Thread[{#1, #2}] & @@@ GatherBy[dat, #[[1]] &]);
lpt = ListPlot[datm, 
   PlotLegends -> 
    PointLegend[Automatic, 
     Style[#, FontFamily -> "Arial"] & /@ DeleteDuplicates[spec], 
     LegendLayout -> (Grid[#, Frame -> True, Alignment -> Left] &)], 
   PlotMarkers -> {Automatic, 12}, Frame -> True, 
   FrameLabel -> {"Day 1", "Day 2"}, 
   BaseStyle -> {FontFamily -> "Arial", 14}, ImageSize -> 600]

enter image description here

If the aim is to take means and variances of species. I leave other ways to visulaize, eg. error bar plots distribution plots up to the intention OP.

mnlp = ListPlot[List /@ (Mean /@ datm), 
   PlotLegends -> 
    PointLegend[Automatic, 
     Style[#, FontFamily -> "Arial"] & /@ DeleteDuplicates[spec], 
     LegendLayout -> (Grid[#, Frame -> True, Alignment -> Left] &)], 
   PlotMarkers -> {Automatic, 12}, Frame -> True, 
   FrameLabel -> {"Day 1", "Day 2"}, 
   BaseStyle -> {FontFamily -> "Arial", 14}, ImageSize -> 600, 
   PlotLabel -> "Mean Values"];
varlp = ListPlot[List /@ (Variance /@ datm), 
  PlotLegends -> 
   PointLegend[Automatic, 
    Style[#, FontFamily -> "Arial"] & /@ DeleteDuplicates[spec], 
    LegendLayout -> (Grid[#, Frame -> True, Alignment -> Left] &)], 
  PlotMarkers -> {Automatic, 12}, Frame -> True, 
  FrameLabel -> {"Day 1", "Day 2"}, 
  BaseStyle -> {FontFamily -> "Arial", 14}, ImageSize -> 600, 
  PlotLabel -> "Variance Values"];

Note: only minimal change was required-> the argument of ListPlot. The above objects are shown below:

enter image description here

enter image description here

share|improve this answer
    
Thanks so much. That's exactly what I needed. Sorry I meant to say I'd taken the sum of xyz and the goal was the variance. Thanks so much again! –  Palaeoanth Apr 20 at 11:42
reorgdata = GatherBy[data[[1]], #[[2]] &][[2 ;;, All, 3 ;;]];
variances = Thread[Variance /@ reorgdata];
means = Thread[Mean /@ reorgdata];
Row[{ListPlot[means, PlotLabel -> "means", ImageSize -> 300], 
    ListPlot[variances, PlotLabel -> "variances", ImageSize -> 300]}]

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.