3
$\begingroup$

I have a number of lists and want to plot all of them vs each other. E.g.:

l={
{a,2,5,4,6},
{b,4,6,6,2},
{c,2,8,3,5},
{d,1,5,2,5}
}

Now I want multiple plots with a vs b a vs c a vs d b vs c etc.

I know there is a function in Mathematica, which does exactly this – because I have used it before. Unfortunately I can't remember the function name and didn't find it in the help menu or here after extensive searching. So I hope someone can remind me of the function name – which I will immediately write down and never forget!

$\endgroup$
2
  • $\begingroup$ Are you thinking of Subsets? $\endgroup$ Aug 20, 2013 at 10:03
  • 2
    $\begingroup$ No, its one simple command, such as xxxPlot[l] and you get all the plots. $\endgroup$ Aug 20, 2013 at 10:45

2 Answers 2

9
$\begingroup$

As said in the comment you can use Subsets!

l = {{a, 2, 5, 4, 6}, {b, 4, 6, 6, 2}, {c, 2, 8, 3, 5}, {d, 1, 5, 2,5}}; 
GraphicsGrid@Partition[
  ListLinePlot[dat = Transpose[#];Rest@dat, 
   FrameLabel -> First@dat, Mesh -> All, 
   MeshStyle -> {{Red, PointSize[.03]}}, Frame -> True] & /@ 
Subsets[l, {2}]), 3]

enter image description here

$\endgroup$
2
  • $\begingroup$ It is a nice solution, but I know there exists this command something like xxxPlot[l] and you instantly get all the diagrams. $\endgroup$ Aug 20, 2013 at 10:51
  • $\begingroup$ OK, after about 3h searching I finally found it deep in the Mathematica help function: PairwiseScatterPlot $\endgroup$ Aug 20, 2013 at 11:01
5
$\begingroup$

OK, I finally found it, after almost 3h of searching, thanks to everyone thinking about it! Here it is:

Needs["StatisticalPlots`"]  
l = {{2, 5, 4, 6}, {4, 6, 6, 2}, {2, 8, 3, 5}, {1, 5, 2, 5}}  
PairwiseScatterPlot[l]
$\endgroup$
1
  • $\begingroup$ that is a good find..;) $\endgroup$ Aug 20, 2013 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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