Parallel Coordinates Plot: Environmental Data

© A.I. McLeod, February 2002

Initializations

First we load the mviz.m package and then input the data and the data labels:

<< "d:\\math\\2001\\mviz\\mviz.m"

x = 
        Partition[ReadData["d:\\math\\2001\\mviz\\data\\envir.dat"], 
          4];

xvar = 
        ReadList["d:\\math\\2000\\mviz\\data\\envir.var", 
          String];

Next we subset the data into the first and fourth quartiles according to the ozone level.  To do this we make use of two of the Standard Packages:

<< Statistics`DescriptiveStatistics`
<< Statistics`DataManipulation`

ozone = First[x // Transpose];
quoz = Quartiles[ozone];
caseslow = 
        BooleanSelect[Range[Length[ozone]], 
          Map[Less[#, quoz[[1]]] &, 
            ozone]];
caseshi = 
        BooleanSelect[Range[Length[ozone]], 
          Map[GreaterEqual[#, 
                quoz[[3]]] &, 
            ozone]];
e = 
        x[[Join[caseslow, 
            caseshi]]];

Produce the plot and its legend

g = 
        ParallelCoordinatesPlot[e, AxesLabels -> xvar, 
          ColorLines -> 
            Join[Table[RGBColor[0, 1, 0], {Length[caseslow]}], 
              Table[RGBColor[0, 0, 1], {Length[caseshi]}]]];

p = 
        LineLegend[{RGBColor[0, 1, 0], 
            RGBColor[0, 0, 
              1]}, {"1st quartile", "4th quartile"}];

Export as EPS graphics

Export["d:\\math\\2001\\mviz\\eps\\parallel.eps", 
      g, "EPSI"]

Export["d:\\math\\2001\\mviz\\eps\\parallel-legend.eps", 
      p, "EPSI"]