Skip to content
Prev 350208 / 398506 Next

color handling in `barplot' inconsistent betwen `beside=FALSE' and `beside=TRUE'

On Mon, 20 Apr 2015 18:10:10 +0200, Marc Schwartz <marc_schwartz at me.com>  
wrote:
hi,

thanks for responding.
well, that would make it "consistent" but it is not what I want, actually  
...
yes, I see. that indeed would work. however, in my actual use case, I have  
a looong time series with dozens of bars. so it would become quite ugly  
(looping over all the bars subsetting the color vector etc). but yes, one  
could do it this way.
yes, I was expecting this answer and I understand it, of course. on the  
other hand, it would be rather straightforward to add another argument to  
`barplot' to control the behaviour (while defaulting to the present one).  
I would think this would be a good addition: in my use case, e.g. I do  
have such categorized and grouped data and just want to be able to plot  
them after sorting within each group according to value while maintaining   
unique color assignments independent of whether the data are sorted within  
each group or not. and with `beside=FALSE'  this is completely  
straightforward (just resort the color vector together with the data),  
while it fails with `beside=TRUE'.
yes, that's what I did. but I wonder how many people would benefit from  
the ability of easily plotting the same data with the same color vs. data  
correspondence independent of the `beside' setting. but it's for the devs  
to decide...
yes, maybe I check whether this would make sense.

thank you,

joerg