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.

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.

share|improve this question
Pls check if PairwiseScatterPlot in StatisticalPlots package fits your needs. –  kguler Mar 22 '12 at 10:27
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. –  Brett Champion Mar 23 '12 at 18:22
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? –  Ruben.Garcia Mar 29 '12 at 2:17

1 Answer 1

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

share|improve this answer

Your Answer


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.