Hi:

I don't know why, but it seems that in

bwplot(voice.part ~ height, data = singer,
main = "NOT THE RIGHT ORDER OF COLOURS\n'yellow' 'blue' 'green' 'red'
'pink' 'violet' 'brown' 'gold'",
fill=c("yellow","blue","green","red","pink","violet","brown","gold"))

the assignment of colors is offset by 3:

Levels: Bass 2 Bass 1 Tenor 2 Tenor 1 Alto 2 Alto 1 Soprano 2 Soprano 1
fillcol <- c("yellow","blue","green","red","pink","violet","brown","gold")

In the above plot,

yellow -> Bass 2  (1)
blue -> Tenor 1     (4)
green -> Soprano 2  (7)
red -> Bass 1 (10 mod 8 = 2)
pink -> Alto 2 (13 mod 8 = 5)
etc.

It's certainly curious.

Dennis


On Tue, Nov 2, 2010 at 2:51 PM, Rainer Hurling <rhurlin@gwdg.de> wrote:

> On 02.11.2010 22:37 (UTC+1), David Winsemius wrote:
>
>>
>> On Nov 2, 2010, at 5:08 PM, Rainer Hurling wrote:
>>
>>  On 02.11.2010 21:43 (UTC+1), David Winsemius wrote:
>>>
>>>>
>>>> On Nov 2, 2010, at 4:07 PM, Rainer Hurling wrote:
>>>>
>>>> snipped quite a bit of talking past each otther
>>>>
>>>>>
>>>>> Of course your example with eight colours works, too. But as you can
>>>>> see in the plot, the colours have different order then in the vector
>>>>> 'colors()[(2:9)*10]' itself. I expected the first box (bass2) coloured
>>>>> "bisque1", the second box (bass1) "blue4" and so on.
>>>>>
>>>>
>>>> Oh. Try putting the fill argument outside the panel and see if the panel
>>>> handles it in the manner you expect:
>>>>
>>>> bp3 <- bwplot(voice.part ~ height, data = singer, main = "fill arg
>>>> outside bwplot\n1] 'bisque1' 'blue4' 'burlywood3' 'chartreuse3' 'coral3'
>>>> 'cyan2' 'darkgray' 'darkorange", fill=colors()[(2:11)*10],
>>>> panel = function(...) {
>>>> panel.grid(v = -1, h = 0)
>>>> panel.bwplot( ...)
>>>> })
>>>> bp3
>>>>
>>>>
>>>>> I hope, this explaination is a bit clearer than my preceding ones.
>>>>>
>>>>
>>>> And I hope my suggestion now "works".
>>>>
>>>
>>> Thank you for the hint, that it works also outside of the panel. It
>>> looks like I missed the wood for trees here ;-)
>>>
>>> In your latest, special case the colours work. After having a nearer
>>> look at it I found that your colour vector has length 10 (2:11), and
>>> only the first eight colours are filled in the boxes.
>>>
>>
>> I don't know why the ordering only is irregularly preserved ...
>> apparently in situations where the number of colors is a multiple of 5.
>> Perhaps a question that Sarkar, Andrews or Ehlers can answer. I looked
>> at the code for bwplot and it uses panel.polygon for drawing the
>> rectangles. The colors and other graphical parameters are supposed to be
>> picked up from the box.rectangle settings in par.settings. (Trying to
>> set those alos failed.) I also looked at panel.polygon and do not see a
>> reason for the shuffling of colors.
>>
>
> I also hope that someone from 'inner circle' would have a look ;-)
>
>
>  Wrong order also:
>>  > bp3 <- bwplot(voice.part ~ height, data = singer, main = "fill arg
>> outside bwplot\n1] 'bisque1' 'blue4' 'burlywood3' 'chartreuse3' 'coral3'
>> 'cyan2' 'darkgray' 'darkorange", par.settings =
>> list(box.rectangle=list(fill=colors()[(2:9)*10])), horizontal=TRUE,
>> + panel = function(...) {
>> + panel.grid(v = -1, h = 0)
>> + panel.bwplot( ...)
>> + })
>>  > bp3
>>
>
> Yes, I tried to manipulate box.rectangle myself with also no success. I
> think, the design of panel.bwplot originally allows only for using one fill
> color (just a guess).
>
>
>  This seems to be reproducable:
>>>
>>> ### NOT WORKING: 8 colours in the not in order of given vector
>>> bwplot(voice.part ~ height, data = singer,
>>> main = "NOT THE RIGHT ORDER OF COLOURS\n'yellow' 'blue' 'green' 'red'
>>> 'pink' 'violet' 'brown' 'gold'",
>>> fill=c("yellow","blue","green","red","pink","violet","brown","gold"))
>>>
>>> ### WORKING: 10 (8+2*NA) colours in order of given vector
>>> bwplot(voice.part ~ height, data = singer,
>>> main = "RIGHT ORDER OF COLOURS\n'yellow' 'blue' 'green' 'red' 'pink'
>>> 'violet' 'brown' 'gold'",
>>> fill=c("yellow","blue","green","red","pink","violet","brown","gold",
>>> NA, NA))
>>>
>>> I really do not understand what is going on here,
>>>
>>
>> Me either.
>>
>
> Thank you so far. I am afraid I have to go to bed. In just a few hours I
> have to work for my employer again ...
>
>
>  Rainer
>>>
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]

