Multiple Charts and Trellis Plots
Dividing the plotting space – small multiples
Overlaying lots of bars and lines can rapidly become confusing – often what you need is to plot several selections of the data in separate small windows on the same chart. GraPL has three ways of tackling this problem:
- you can have more than one frame, with separate charts in each
- you can manually set up a ‘Trellis’ and have a set of quite independent charts drawn in each cell
- you can use the Multiple chart element to build a trellis automatically
The simplest option is just to divide up the plotting space into two or more frames and make a separate plot in each. Each frame has its own ‘bounding box’ which gives the (x,y) co-ordinates of the lower-left and upper-right corners in points (if you want to work in inches or cm, use the ‘...’ pop-up to enter the numbers) – if you have more than one frame, GraPL automatically sets the bounding-box for the entire page to wrap around all of them.
Say we want a barchart and a pie chart shown together:
This example is part of the ‘barchart’ project from your samples folder. The initial barchart has been drawn on the default frame, and then I have simply dragged across a second frame from the Chart elements tab and set its co-ordinates to the top right corner. Now I can just carry on and plot a completely new chart in the second frame – in this case I have used the Sum function to show the total sales in each region.
You will have noticed that the new frame is ‘boxed’ which is why it has the black edge, but that it also blanks out anything underneath it. This is not always what you want, as it would be quite reasonable to draw the piechart over the barchart in that nice empty space above the first few months. If you bring up the ‘...’ box on the frame style you will see that both ‘Boxed’ and ‘Wipe frame’ are ticked – uncheck both and you will find that you have a totally see-through frame which you can place anywhere you like:
Here I have increased the frame of the original barchart and dropped the piechart on top of it. Clearly this is a ‘one-off’ design, in that it is totally dependent on the pattern of the data, but if you simply want to publish some numbers in an annual report, then who cares? It will all be different next year anyway.
Setting up a trellis
There is nothing to stop you getting out your ruler and calculator and setting up a whole stack of frames in a neat grid. GraPL takes the view that computers are good at this sort of thing, and comes with a built-in capability to divide up the plotting space into a collection of similar cells, called a Trellis. The next two sections show how to use a trellis ‘manually’ to plot a collection of similar charts, and then to use the Multiple element which automates the whole process.
First, let’s look at some data where we can set up a trellis manually. The “Norber Erratics” are a collection of perched boulders which a glacier deposited on a limestone pavement around 10,000 years ago. You can load the GraPL Project ‘Norber’ from your samples folder to have a look at the example which follows. The datasheet has measurements taken around the 4 compass points for 120 of these rocks showing how far the limestone has eroded away from beneath them over the years:
The interesting question we want to explore is whether the erosion was noticeably faster on any one side. Obviously we could do a set of frequency plots, print them out and hold them up to the light, but a better way is to have GraPL set up a 4-pane trellis so we can compare the directions side by side:
Here I started with a new chart, and dragged over a ‘Trellis’ from the Chart elements tab. You can either give a single number here (in this example it would be 4) or tell GraPL explicitly the number of rows and columns you want laid out. Here I have asked for a 2×2 grid as I know we have 4 plots to make. By default, GraPL will carry on piling chart after chart on the same set of axes – you can make an explicit jump to a new cell by adding a NewCell element after every chart, or (as here) save some time by setting the trellis to skip on automatically. If you check the ‘...’ button for the trellis style, you will see that you can also choose to reset the plot at every cell; this is not what we want here as it is important to keep a consistent set of axes across all the plots.
Now let’s add the first chart by dragging over a Frequency plot and setting a suitable class interval:
With a bit of experiment, it looks as if 10 is a good value here. You will notice that the chart has fitted in to the top left corner of the normal space, and that everything has scaled down nicely. GraPL takes great care to scale typesizes and line-weights down so that your charts will continue to look really good at very small sizes – you don’t need to worry about reducing the headings, axis labels and so on. Now we can add the other three charts, but first we should identify which one is which, so let’s add a subheading to the first one and set it to ‘North’:
The other thing I have done here is to tidy up the heading properties by deleting the unwanted lines, and I have added an explicit setting for the X-axis range to ensure that all the plots are done on the same baseline. Now we can use the clipboard – with the cursor on the ‘Frequency’ line hit Ctrl+C to copy the plot and all its properties to the clipboard. Move to the very bottom of the specification and hit Ctrl+V twice to paste another two charts, leaving the finished graphic like this:
Well, I think South looks clearly different from the other three – what do you think? Just for interest, here is a Box & Whisker plot of the same data, which is another very good way of making a quick visual comparison:
Again, South looks well out of line with the other three. Incidentally, this example shows one other important point – you will notice that I have put quotes around the “North,East,South,West” values for the x-axis labels. This is because GraPL can also take data direct from a datasheet to label the axes, and in this case these names happen also to be valid column names. You might like to try taking the quotes out to see what happens!
This is a useful technique when you have many criteria and only one column of results – a typical set of data (quoted by many statistics texts over the years) concerns yields of 10 varieties of barley, grown at 6 farms in 1931 and 1932. Here is part of the datasheet – you can load this from your samples folder if you want to play with it:
We could run a simple frequency plot of the entire dataset, but clearly what we want to see is whether any particular variety or farm was outstanding. The Multiple chart element is a kind of higher level operator – it drives a chosen chart element around in a loop, executing it once for every unique item in its category list. If I drag across a Multiple, set its Chart type to Frequency and set the Categorise by parameter to Farm, I get six small frequency plots:
... try this with categories of Year (which will give two plots) and Variety (which will give 10) to see the effect. Of course you can omit the categorisation completely, which just falls back to running a single frequency plot of the entire dataset. As a final experiment, add a Trellis style and switch it from cell-based (the default) to Paged multiples. This time GraPL will generate each chart on a new page, and you can use PgDn and PgUp to look through them. If you print the ‘chart’ GraPL will print all the pages for you; use the ‘Print page’ button on the full-screen chart view (double-click the thumbnail) to be selective.
Continue to: Linking Datasheets
|