[R] barplot groups of different size i.e. height is NOT a matrix

From: Victor Gabillon <victor.gabillon_at_inria.fr>
Date: Wed, 25 May 2011 14:56:07 +0200


I want to use the function barplot do display several group of bars. A standard example is given at this link http://onertipaday.blogspot.com/2007/05/make-many-barplot-into-one-plot.html

But in their example the 4 groups of bars are all composed of 8 bars. I want to be able do display the same kind of graph but where the number of bars in each group are not the same. For example the first group of bars would have 2 bars and the second group of bars would have 10 bars.

barplot function has a first parameter named height which is a matrix where each line are the values for the bars of one particular group. One solution could be to have a height matrix with NA values but then the space occupied by each group is equal to the size of the largest group!! So you end up with gaps (empty) where there are NAs.

Do you know how to solve this problem?
Do i have to consider multiple barplots in the same plot with the same axis? (btw, i don't know how to do that)

In fact the bar would represent the performance of an algorithm. A group of bars would be the performance of an algorithms with different parameters.
But when comparing different algorithms it is possible that we don't want to display the same number of parameters for each algorithm.

Thanks for your help.

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 25 May 2011 - 12:58:54 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 25 May 2011 - 15:20:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive