[R] barplot() using beside=TRUE and the density argument

2004-12-01 Thread michael watson \(IAH-C\)
Hi

I am using barplot() to draw some barplots, with a matrix as the data so
that multiple bars are drawn for each data point.  I want to use the
argument beside=TRUE to juxtapose the bars instead of stacking them.

If I execute:

barplot(data,names.arg=names,density=c(20,10),beside=FALSE)

I get the expected behaviour i.e. the bottom part of the column is
shaded 20 lines per inch, the top part 10 lines per inch.  However, if I
try:

barplot(data,names.arg=names,density=c(20,10),beside=TRUE)

I don't get what *I* would expect (which admittedly might be the wrong
thing!).  What happens is that the left bar for each data point is
shaded 20 lines per inch, and the right bar is not shaded at all.

Any help would be very much appreciated.

Mick

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] barplot() using beside=TRUE and the density argument

2004-12-01 Thread Petr Pikal

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] barplot() using beside=TRUE and the density argument

2004-12-01 Thread Marc Schwartz
On Wed, 2004-12-01 at 10:46 +, michael watson (IAH-C) wrote:
 Hi
 
 I am using barplot() to draw some barplots, with a matrix as the data so
 that multiple bars are drawn for each data point.  I want to use the
 argument beside=TRUE to juxtapose the bars instead of stacking them.
 
 If I execute:
 
 barplot(data,names.arg=names,density=c(20,10),beside=FALSE)
 
 I get the expected behaviour i.e. the bottom part of the column is
 shaded 20 lines per inch, the top part 10 lines per inch.  However, if I
 try:
 
 barplot(data,names.arg=names,density=c(20,10),beside=TRUE)
 
 I don't get what *I* would expect (which admittedly might be the wrong
 thing!).  What happens is that the left bar for each data point is
 shaded 20 lines per inch, and the right bar is not shaded at all.
 
 Any help would be very much appreciated.
 
 Mick

Without a reproducible example, it is hard to know exactly what you are
seeing. 

Running the following example:

barplot(matrix(1:12, ncol = 6), density = c(20, 10), beside = TRUE)

I will admit that the right hand bars in the plot have a shading that is
very light and may be difficult to see on your system, but they are
there.

You might want to try the following:

barplot(matrix(1:12, ncol = 6), density = c(20, 10), 
col = c(red, blue), beside = TRUE)

to see if the addition of color makes a difference, or if not, try to
increase the second density value.

If this does not help, please provide a reproducible example.

HTH,

Marc Schwartz

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html