5
$\begingroup$

I'm trying to do multivariate statistical analysis on a data set and I'd like to quickly visualize my information first using Trellis-like plots. For example, I'd like to create scatterplots for body mass and height separated by region.

I'm currently creating all the graphs individually and then displaying them together with GraphicsGrid but I'm wondering if there's a better way of doing it.

$\endgroup$
  • 3
    $\begingroup$ Pls check if PairwiseScatterPlot in StatisticalPlots package fits your needs. $\endgroup$ – kglr Mar 22 '12 at 10:27
  • 1
    $\begingroup$ There's also a version on a New-in-V8 page that contains a lot of tricks for making this sort of thing look nice. $\endgroup$ – Brett Champion Mar 23 '12 at 18:22
  • $\begingroup$ I'm familiar with the PairwiseScatterPlot function but unfortunately in this case it doesn't work since the habitat, the 3rd variable, is categorical. Any other suggestions? $\endgroup$ – Ruben Garcia Mar 29 '12 at 2:17
1
$\begingroup$

Perhaps this is what you are doing, but just in case:

t = Table[{RandomChoice[{"Reg1", "Reg2", "Reg3"}], 
    RandomReal[{10, 20}], RandomReal[{50, 70}]}, {i, 1, 10}];
sel[x_] := Select[t, #[[1]] == "Reg" <> ToString[x] &];
plt[x_] := ListLinePlot[#] &@(sel[x][[All, 2 ;; 3]]);

pltR = Flatten[Options[plt[#], PlotRange] & /@ Range[3] /. 
              HoldPattern[PlotRange -> x_] -> x, 1];
pltRR = {{Min@pltR[[All, 1, 1]],  Max@pltR[[All, 1, 2]]}, 
         {Min@pltR[[All, 2, 1]],  Max@pltR[[All, 2, 2]]}};

GraphicsGrid[{ListLinePlot[#, PlotRange -> pltRR] &@ (sel[#][[All, 2 ;; 3]]) & 
             /@ Range[3]}, Dividers -> All]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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