Search Locate Previous Next Contents

Positioning Small Plots on the Page

There are many possible techniques for representing high-dimensional data on a plane surface. One which is frequently used for geographically-based information is to use the xy co-ordinates of various survey sites (in the UK this data is easily determined from the National Grid) to position a miniature plot showing the data at that site. The RainPro workspace has a fairly complex example culled from the Proceedings of the Yorkshire Geological Society which shows alignments of various fossils in some Teesdale and Weardale quarries. Run function PYGS to see this plot:


You may find it hard to believe, but this is genuine data!

A simple example of the technique might be the relative frequency of various chemicals in a reaction vessel at different pressures and temperatures. Say we made three measurements of two compounds with (pressure,temperature) set to (100 30)(150 45)(75 60) – a simple xy-scatter will plot these values for us:

xy„3 2½100 30,150 45,75 60
chSet'boxed,xyplot,nolines'
chSet('xr' 50 180)('yr' 20 70)
chPlot xy
PG„chClose

Now what we need to do is to use these co-ordinates as the location for a set of small barcharts showing the detailed values measured at each point. Rather than setting up a trellis of equally sized and regularly spaced plots, we must tell Rain to record the xy locations in the scatter plot and to use these as the centres of a set of cell-locations:

© Generate cells centred at the xy points
 chSet'xyplot,nolines,nomarkers,cells'

We might also want to adjust the default cell sizes in this case as the barcharts can be drawn quite large. Here is the complete example, with some randomly generated measurements:


 r„ScatterBar;xy;cell
© Tutorial example with scattered barcharts
© Illustrates the general technique of high-dimensional plotting
 xy„3 2½100 30,150 45,75 60
© Generate cells at the xy points
 chSet'boxed,xyplot,nolines,nomark,cells'
 chSet'head' 'Cumulative Yields of Various Fractions'
 chSet'subhead' 'Charts show total amount of each collected'
 chSet('Ycap' 'Temperature')('Xcap' 'Pressure')
 chSet('xr' 50 180)('yr' 20 70)('cell' 144 96)
 chPlot xy
© Force a full reset here to shake off headings etc from outer chart
 chReset
© Ensure the small charts don't blank out bits of the main axes etc
 chSet('style' 'forcezero,stacked,nowipe')
 chSet('gap' 0.5)('xlab' 'Ethanol,Propanol')('ycap' 'ml')('ys' 'atend')
© Force them all to scale to the same y-axis for comparability
 chSet'yr' 0 40
© Walk around the cells ...
 :For cell :In ¼3
   chNewCell
   chBar 2 3½3+?7 11
 :End
 chNew'' ª chSet'Key'('After 10 mins' 'After 20 mins' 'After 1 hour')
 PG„chClose
 r„'View PG'

Piecharts and polar charts work particularly well as miniatures, as they accurately locate the xy co-ordinate for you – see the PieMarkers example for some more ideas.

See also ...
chPolar – polar charts
CellSize – cell size when using markers to make cells


Continue to: Some Basic Statistics (Frequency Plot)
© Copyright Causeway Graphical Systems Ltd 2003