# Easy Way to Create Trellis Plots in Mathematica

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.

• Pls check if PairwiseScatterPlot in StatisticalPlots package fits your needs.
– kglr
Mar 22, 2012 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. Mar 23, 2012 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? Mar 29, 2012 at 2:17

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]