Skip to content

lattice barchart sorting and coloring

2 messages · Alexander.Herr@csiro.au, Deepayan Sarkar

#
On Thursday 12 December 2002 10:25 pm, Alexander.Herr at csiro.au wrote:
What do you mean by your data is 'ordered' ? I am guessing your x variable is 
just character strings. character variables are converted into factors before 
being plotted, and the order in which they are plotted is determined by the 
order in which they appear in the levels of that factor. By default, factor 
levels are assigned in alphabetical order, which is what you are seeing in 
barchart. For example,
[1] "jan" "mar" "mar" "feb" "mar" "feb" "mar" "feb" "jan" "mar"
[1] jan mar mar feb mar feb mar feb jan mar
Levels: feb jan mar
[1] jan mar mar feb mar feb mar feb jan mar
Levels: jan mar feb
Create the factor beforehand with the ordering you want.
Not doable yet, unless you write your own panel function. I have plans to 
implement this, but probably not before next year/month.

Deepayan