On 30-Mar-09 23:04:15, kerfuffle wrote:> hi folks,
>
> I was wondering if anybody could give me some advice. I've created
> a stacked barchart, with 'car model' along the x axis, 'number
of
> cars' along the y axis. There are 45 individuals involved, each of
> which can own any number of cars, of any model (eg an individual
could own two cars of one model, and another car of a different
model).> I've got a legend by the side of the barchart which gives the name
> of the individual, which gives the colour to identify which bars
> belong to which individuals.
> The problem (as you've probably guessed) is that it's almost
> impossible to have a distinctive legend for 45 individuals. I can
> manage 30 distinctive colors, but as soon as I use shaded lines the
> number of distinct colours drops considerably because the legend
> boxes are so small. This is true even if I vary line density and
> angle. Therefore, after a long period of experimentation, I'm
> thinking of giving up on barchart.
>
> What I have in mind now is a plot where each 'bar' is a single
line,
> and the top of each 'bar' is a symbol (+, *, etc). I figure it
should
> be possible to find 45 different symbols. Does anyone have any
> advice? I'm sorry this is so open-ended, but I've played with
> stripchart and dotplot without a lot of joy. I figure this can't be
> that uncommon a need (barchart with a ridiculous number of groups),
> but I could well be wrong. Is there some way of altering the size
> of the legend boxes in the barchart? Using symbols in the barchart?
> Some way of using, say, 30 blocks of colour, and 15 cases of
> a dashed line?
>
> Any thoughts would be greatly appreciated.
> Paul
(I hope this has nothing to do with the image of blocked traffic
on the CEH website ... :))
Certainly, unreasonable use of barcharts is not uncommon. And it
invariably fails to communicate much! It seems you are trying to
simultaneously present comparisons between numbers of cars owned
by different owners, how these are distributed across models,
how ownership varies by model, and how ownership varies by owner.
This is overloading the communicative capabilities of the barchart.
Thinking about possible variants of the barchart idea which might
better fit your aims, I've thought of the following possibility.
You don't say how many models of car are involved, but say it
is 20. You don't say what the maximum number of cars of one model
owned by a single owner is, but say it is 5. You have 45 owners.
The design is as follows.
1. Put 20 vertical bars along the X-axis, one for each model.
2. Make them tall -- 45 times some unit (and the unit must be large
enough to be divided into 5 equal vertical parts large enough
to be easily distinuished visually).
3. Associate vertial unit i with owner i.
4. Fill in each total vertical bar with a discreet background colour.
5. For owner i and car model M, let NiM be the number of cars of
model M owned by owner i. Fill in the bottom NiM/5 fraction of
verttical block i of bar M with a vivid foreground colour.
6. At the far right, or left, level with each block i, put the
identity of owner i.
In other words, it is like a kind of "crossed bar chart", with
vertical bars corresponding to car models, and horizontal bars
corresponding to owners, and where vertical bar M meets horizontal
bar i the size of the intersection is proportional to the number
of cars of model M owner by owner i.
As described, the natural visual comparison which will be made
by the eye will be the vertical heights of the highlighted
areas corresponding to a single owner i -- i.e. the eye will
run horizontally and perceive the differences of height. Therefore
it directly tells you how model ownership varies by model, for
each owner.
It will not be easy to compaqre the differences of height, for
the different owners, for a single model M -- since this requires
the eye to run vertically, and it will not readily make the
comparison.
However, you could also add bars which stick out sideways from
the vertical bars, by amounts proportional to the ownership of
model M by owner i -- in the same way as the vertical divisions.
Then the eye can also run vertically and easily pick up the
different ownerships of a given model M by different owners i.
None of these gives you either
a) Comparison between models M of total ownership of a given
model over the different owners;
b) Comparison between owners i of their total numbers of cars
owned, over the different car models.
However, you can also adjoin, to the array of coloured blocks already
constructed, marginal bar charts:
A) For car models: Above the whole diagram, have a barchart with
horizontal axis and vertical bars, one for each car model M,
whose heights are proportional to the total number of cars of
model M owned by all owners together;
B) For owners: To the right of the whole diagram, have a barchart
with vertical axis and horzontal bars, whose lengths for each
owner i are proportional to the total cars owned by owner i.
The (A) answers (a), and (B) answers (b).
As to how best to achieve this in R, I'm not sure. In any case,
I don't draw sophisticated graphics like this directly in R,
since I would want totally precise control over sizes, shapes
and positions in the result. I in fact use the 'pic' component
of the 'groff' package (though these days it may be possible to
achive the same sort of result in TeX). However (staying on topic)
I would certainly get R to generate the data array from which
the graphic would be drawn by 'pic'. Other graphics software may
also allow this to be easily and precisly done (I would not like
to recommend Excel ... ).
If you were to post the data, or a suitable set of similar artificial
data (or mail to me privately) I would be happy to try my hand at
producing the sort of thing described above.
Then you could judge whether you liked it!
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 31-Mar-09 Time: 01:58:41
------------------------------ XFMail ------------------------------