[R] barcharts with 2 different axes

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Oct 27 07:52:38 CEST 2006


On 10/26/06, Geoff Russell <geoffrey.russell at gmail.com> wrote:
> Dear UseRs,
>
> I'm having trouble drawing a barchart  with 2 quantities in different units
> as follows with
> one unit on the top axis and the other unit on the bottom. E.g.,
>
>                x Tonnes |             .
> .                  .
>
> Row 1 Tonnes1      | xxxxxxxxxx
> Row 1 Litres1         | yyyyyyy
>
> Row 2 Tonnes1      | xxxxxxxxxxxxxxxxxxxxx
> Row 2 Litres1         | yyyyyyyyyyyyyyyy
>
>                y Litres    |            .

So if I read this right, the relative heights of the xxx bars and the
yyy bars, which you have placed side by side, are in different units
and thus their comparison is meaningless. It's doable, but do you
really want this sort of graph? A better and much easier to implement
design seems to be something like

      +-------------------------+---------------------+
Row 1 | xxxxxxxxxx     	       	| yyyyyyy 	      |
Row 2 | xxxxxxxxxxxxxxxxxxxxx  	| yyyyyyyyyyyyyyyy    |
      +-------------------------+---------------------+
	 Tonnes1	       	   Litres1

> Can anybody provide an example please?

Please provide some example data (the form of which will matter).

-Deepayan



More information about the R-help mailing list