Re: [R] Colour filling in panel.bwplot from lattice

2010-11-03 Thread Deepayan Sarkar
On Wed, Nov 3, 2010 at 4:11 AM, Dennis Murphy djmu...@gmail.com wrote:
 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.

Curious indeed. It turns out that because of the way this was
implemented, every 11th color was used, so you end up with the order

 sel.cols - c(yellow,blue,green,red,pink,violet,brown,gold)
 rep(sel.cols, 100) [ seq(1, by = 11, length.out = 8) ]
[1] yellow redbrown  blue   pink   gold   green  violet

It's easy to fix this so that we get the expected order, and I will do
so for the next release.

Having said that, it should be noted that any vectorization behaviour
in lattice panel functions is a consequence of implementation and not
guaranteed by design (although certainly useful in many situations).
In particular, it is risky to depend on vectorization in multipanel
plots, because the vectorization starts afresh in each panel for
whatever data subset happens to be in that panel, and there may be no
relation between the colors and the original data.

One alternative is to use panel.superpose with panel.groups=panel.bwplot:

bwplot(voice.part ~ height, data = singer, groups = voice.part, panel
= panel.superpose, panel.groups = panel.bwplot, fill = sel.cols)

-Deepayan

__
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.


Re: [R] Colour filling in panel.bwplot from lattice

2010-11-03 Thread Rainer Hurling

Am 03.11.2010 10:23 (UTC+1) schrieb Deepayan Sarkar:

On Wed, Nov 3, 2010 at 4:11 AM, Dennis Murphydjmu...@gmail.com  wrote:

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.


Curious indeed. It turns out that because of the way this was
implemented, every 11th color was used, so you end up with the order


sel.cols- c(yellow,blue,green,red,pink,violet,brown,gold)
rep(sel.cols, 100) [ seq(1, by = 11, length.out = 8) ]

[1] yellow redbrown  blue   pink   gold   green  violet

It's easy to fix this so that we get the expected order, and I will do
so for the next release.


Thank you for this proposal. We are looking forward for the next release :-)

We frequently have to colour selected boxes to be able to compare 
special cases over different panels.



Having said that, it should be noted that any vectorization behaviour
in lattice panel functions is a consequence of implementation and not
guaranteed by design (although certainly useful in many situations).
In particular, it is risky to depend on vectorization in multipanel
plots, because the vectorization starts afresh in each panel for
whatever data subset happens to be in that panel, and there may be no
relation between the colors and the original data.


Thank you for the warning.


One alternative is to use panel.superpose with panel.groups=panel.bwplot:

bwplot(voice.part ~ height, data = singer, groups = voice.part, panel
= panel.superpose, panel.groups = panel.bwplot, fill = sel.cols)


This indeed works nice 'as a workaround'.


-Deepayan


Thanks again for this wonderful package,
Rainer

__
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.


Re: [R] Colour filling in panel.bwplot from lattice

2010-11-03 Thread Deepayan Sarkar
On Wed, Nov 3, 2010 at 4:25 PM, Rainer Hurling rhur...@gwdg.de wrote:
 Am 03.11.2010 10:23 (UTC+1) schrieb Deepayan Sarkar:

 On Wed, Nov 3, 2010 at 4:11 AM, Dennis Murphydjmu...@gmail.com  wrote:

 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.

 Curious indeed. It turns out that because of the way this was
 implemented, every 11th color was used, so you end up with the order

 sel.cols-
 c(yellow,blue,green,red,pink,violet,brown,gold)
 rep(sel.cols, 100) [ seq(1, by = 11, length.out = 8) ]

 [1] yellow red    brown  blue   pink   gold   green
  violet

 It's easy to fix this so that we get the expected order, and I will do
 so for the next release.

 Thank you for this proposal. We are looking forward for the next release :-)

 We frequently have to colour selected boxes to be able to compare special
 cases over different panels.

 Having said that, it should be noted that any vectorization behaviour
 in lattice panel functions is a consequence of implementation and not
 guaranteed by design (although certainly useful in many situations).
 In particular, it is risky to depend on vectorization in multipanel
 plots, because the vectorization starts afresh in each panel for
 whatever data subset happens to be in that panel, and there may be no
 relation between the colors and the original data.

 Thank you for the warning.

 One alternative is to use panel.superpose with panel.groups=panel.bwplot:

 bwplot(voice.part ~ height, data = singer, groups = voice.part, panel
 = panel.superpose, panel.groups = panel.bwplot, fill = sel.cols)

 This indeed works nice 'as a workaround'.

Actually, I would reiterate that this is the right solution and the
it's other fix that qualifies as a quick workaround (especially if you
are considering comparing things across multiple panels).

-Deepayan

__
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.


Re: [R] Colour filling in panel.bwplot from lattice

2010-11-03 Thread Rainer Hurling

Am 03.11.2010 12:52 (UTC+1) schrieb Deepayan Sarkar:

On Wed, Nov 3, 2010 at 4:25 PM, Rainer Hurlingrhur...@gwdg.de  wrote:

Am 03.11.2010 10:23 (UTC+1) schrieb Deepayan Sarkar:


On Wed, Nov 3, 2010 at 4:11 AM, Dennis Murphydjmu...@gmail.comwrote:


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.


Curious indeed. It turns out that because of the way this was
implemented, every 11th color was used, so you end up with the order


sel.cols-
c(yellow,blue,green,red,pink,violet,brown,gold)
rep(sel.cols, 100) [ seq(1, by = 11, length.out = 8) ]


[1] yellow redbrown  blue   pink   gold   green
  violet

It's easy to fix this so that we get the expected order, and I will do
so for the next release.


Thank you for this proposal. We are looking forward for the next release :-)

We frequently have to colour selected boxes to be able to compare special
cases over different panels.


Having said that, it should be noted that any vectorization behaviour
in lattice panel functions is a consequence of implementation and not
guaranteed by design (although certainly useful in many situations).
In particular, it is risky to depend on vectorization in multipanel
plots, because the vectorization starts afresh in each panel for
whatever data subset happens to be in that panel, and there may be no
relation between the colors and the original data.


Thank you for the warning.


One alternative is to use panel.superpose with panel.groups=panel.bwplot:

bwplot(voice.part ~ height, data = singer, groups = voice.part, panel
= panel.superpose, panel.groups = panel.bwplot, fill = sel.cols)


This indeed works nice 'as a workaround'.


Actually, I would reiterate that this is the right solution and the
it's other fix that qualifies as a quick workaround (especially if you
are considering comparing things across multiple panels).


Yes, this comparing across multiple panels was our intention.
Rainer


-Deepayan


__
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.


[R] Colour filling in panel.bwplot from lattice

2010-11-02 Thread Rainer Hurling
Inspired by colouring the dots of box-whisker plots I am trying to also 
fill the boxes (rectangles) with different colours. This seems not to 
work as I expected.


Looking at the help page of panel.bwplot it says: 'fill - color to fill 
the boxplot'. Obviously it is only intended to fill all boxes with only 
one colour?


Nevertheless the following example shows, that 'fill' from panel.bwplot 
is able to work with more than one colour. But this only works with one 
colour or multiples of 5 colours:



-
bp1 - bwplot(voice.part ~ height, data = singer, main=1 color works,
  panel = function(...) {
panel.bwplot(col=c(yellow),
 fill=c(yellow), ...)
  })

bp2 - bwplot(voice.part ~ height, data = singer, main = 3 colors do 
NOT work,

  panel = function(...) {
panel.grid(v = -1, h = 0)
panel.bwplot(col=c(yellow,blue,green),
 fill=c(yellow,blue,green), ...)
  })

bp3 - bwplot(voice.part ~ height, data = singer, main = 5 colors do work,
  panel = function(...) {
panel.grid(v = -1, h = 0)
panel.bwplot(col=c(yellow,blue,green,pink,red),

fill=c(yellow,blue,green,pink,red), ...)
   })

plot(bp1, split=c(1,1,1,3))
plot(bp2, split=c(1,2,1,3), newpage=FALSE)
plot(bp3, split=c(1,3,1,3), newpage=FALSE)
-


Is there any chance to use more than one filling colour correctly?

Thanks in advance,
Rainer Hurling

__
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.


Re: [R] Colour filling in panel.bwplot from lattice

2010-11-02 Thread David Winsemius


On Nov 2, 2010, at 1:19 PM, Rainer Hurling wrote:

Inspired by colouring the dots of box-whisker plots I am trying to  
also fill the boxes (rectangles) with different colours. This seems  
not to work as I expected.


Looking at the help page of panel.bwplot it says: 'fill - color to  
fill the boxplot'. Obviously it is only intended to fill all boxes  
with only one colour?


Nevertheless the following example shows, that 'fill' from  
panel.bwplot is able to work with more than one colour. But this  
only works with one colour or multiples of 5 colours:



-
bp1 - bwplot(voice.part ~ height, data = singer, main=1 color  
works,

 panel = function(...) {
   panel.bwplot(col=c(yellow),
fill=c(yellow), ...)
 })

bp2 - bwplot(voice.part ~ height, data = singer, main = 3 colors  
do NOT work,

 panel = function(...) {
   panel.grid(v = -1, h = 0)
   panel.bwplot(col=c(yellow,blue,green),
fill=c(yellow,blue,green), ...)
 })

bp3 - bwplot(voice.part ~ height, data = singer, main = 5 colors  
do work,

 panel = function(...) {
   panel.grid(v = -1, h = 0)

panel.bwplot(col=c(yellow,blue,green,pink,red),

fill=c(yellow,blue,green,pink,red), ...)
  })

plot(bp1, split=c(1,1,1,3))
plot(bp2, split=c(1,2,1,3), newpage=FALSE)
plot(bp3, split=c(1,3,1,3), newpage=FALSE)
-


Is there any chance to use more than one filling colour correctly?



You have eight boxes to fill and 8 dots to color. You can either  
supply 8 distinct colors or you can supply some lesser number and they  
will be recycled across the entire 8 boxes and dots. What you cannot  
do ( and expect to see the dots against the fill background) is plot  
the dots as the same colors as the fill.


This will let you see all colors of dots and fill with only 4 colors  
because I set it up so there was no two identical colors in teh  
sequence of dots and fill during hte reculing:


bp4 - bwplot(voice.part ~ height, data = singer, main = 5 colors do  
work,

  panel = function(...) {
panel.grid(v = -1, h = 0)
 
panel.bwplot(col=rev(c(yellow,blue,green,pink)),

 fill=c(yellow,blue,green,pink), ...)
   })
 bp3




Thanks in advance,
Rainer Hurling

__
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.


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.


Re: [R] Colour filling in panel.bwplot from lattice

2010-11-02 Thread Rainer Hurling

On 02.11.2010 19:08 (UTC+1), David Winsemius wrote:

On Nov 2, 2010, at 1:19 PM, Rainer Hurling wrote:


Inspired by colouring the dots of box-whisker plots I am trying to
also fill the boxes (rectangles) with different colours. This seems
not to work as I expected.

Looking at the help page of panel.bwplot it says: 'fill - color to
fill the boxplot'. Obviously it is only intended to fill all boxes
with only one colour?

Nevertheless the following example shows, that 'fill' from
panel.bwplot is able to work with more than one colour. But this only
works with one colour or multiples of 5 colours:


-
bp1 - bwplot(voice.part ~ height, data = singer, main=1 color works,
panel = function(...) {
panel.bwplot(col=c(yellow),
fill=c(yellow), ...)
})

bp2 - bwplot(voice.part ~ height, data = singer, main = 3 colors do
NOT work,
panel = function(...) {
panel.bwplot(col=c(yellow,blue,green),
fill=c(yellow,blue,green), ...)
})

bp3 - bwplot(voice.part ~ height, data = singer, main = 5 colors do
work,
panel = function(...) {
panel.bwplot(col=c(yellow,blue,green,pink,red),
fill=c(yellow,blue,green,pink,red), ...)
})

plot(bp1, split=c(1,1,1,3))
plot(bp2, split=c(1,2,1,3), newpage=FALSE)
plot(bp3, split=c(1,3,1,3), newpage=FALSE)
-

Is there any chance to use more than one filling colour correctly?




Thanks for answering.


You have eight boxes to fill and 8 dots to color. You can either supply
8 distinct colors or you can supply some lesser number and they will be
recycled across the entire 8 boxes and dots. What you cannot do ( and
expect to see the dots against the fill background) is plot the dots as
the same colors as the fill.


It was not my intention to get the dots coloured in the same colour as 
the boxes. Instead I am looking for a method to fill the boxes with a 
predefined set of different colours (from a color vector). As far as I 
can see this is only possible for one colour and multitudes of five colours.


The dots should remain uncoloured ...


This will let you see all colors of dots and fill with only 4 colors
because I set it up so there was no two identical colors in teh sequence
of dots and fill during hte reculing:

bp4 - bwplot(voice.part ~ height, data = singer, main = 5 colors do
work,
panel = function(...) {
panel.bwplot(col=rev(c(yellow,blue,green,pink)),
fill=c(yellow,blue,green,pink), ...)
})


In your example you can see that the dots colors are painted in the 
right (reversed) order, the boxes are painted as sequence 
c(yellow,pink,green,blue) instead of 
c(yellow,blue,green,pink).


I do not understand how to turn over a given order and with a given 
count of colours to the boxes.




Thanks in advance,
Rainer Hurling


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.


Re: [R] Colour filling in panel.bwplot from lattice

2010-11-02 Thread David Winsemius


On Nov 2, 2010, at 2:32 PM, Rainer Hurling wrote:


On 02.11.2010 19:08 (UTC+1), David Winsemius wrote:

On Nov 2, 2010, at 1:19 PM, Rainer Hurling wrote:


Inspired by colouring the dots of box-whisker plots I am trying to
also fill the boxes (rectangles) with different colours. This seems
not to work as I expected.

Looking at the help page of panel.bwplot it says: 'fill - color to
fill the boxplot'. Obviously it is only intended to fill all boxes
with only one colour?

Nevertheless the following example shows, that 'fill' from
panel.bwplot is able to work with more than one colour. But this  
only

works with one colour or multiples of 5 colours:


-
bp1 - bwplot(voice.part ~ height, data = singer, main=1 color  
works,

panel = function(...) {
panel.bwplot(col=c(yellow),
fill=c(yellow), ...)
})

bp2 - bwplot(voice.part ~ height, data = singer, main = 3 colors  
do

NOT work,
panel = function(...) {
panel.bwplot(col=c(yellow,blue,green),
fill=c(yellow,blue,green), ...)
})

bp3 - bwplot(voice.part ~ height, data = singer, main = 5 colors  
do

work,
panel = function(...) {
panel.bwplot(col=c(yellow,blue,green,pink,red),
fill=c(yellow,blue,green,pink,red), ...)
})

plot(bp1, split=c(1,1,1,3))
plot(bp2, split=c(1,2,1,3), newpage=FALSE)
plot(bp3, split=c(1,3,1,3), newpage=FALSE)
-

Is there any chance to use more than one filling colour correctly?




Thanks for answering.

You have eight boxes to fill and 8 dots to color. You can either  
supply
8 distinct colors or you can supply some lesser number and they  
will be

recycled across the entire 8 boxes and dots. What you cannot do ( and
expect to see the dots against the fill background) is plot the  
dots as

the same colors as the fill.


It was not my intention to get the dots coloured in the same colour  
as the boxes. Instead I am looking for a method to fill the boxes  
with a predefined set of different colours (from a color vector). As  
far as I can see this is only possible for one colour and multitudes  
of five colours.


Huh? My example used 4 colors. It should have worked with eight colors  
as well. There are eight groups and




The dots should remain uncoloured ...


Then leave out the col= argument (assuming uncolored means black.)




This will let you see all colors of dots and fill with only 4 colors
because I set it up so there was no two identical colors in teh  
sequence

of dots and fill during hte reculing:

bp4 - bwplot(voice.part ~ height, data = singer, main = 5 colors do
work,
panel = function(...) {
panel.bwplot(col=rev(c(yellow,blue,green,pink)),
fill=c(yellow,blue,green,pink), ...)
})


In your example you can see that the dots colors are painted in the  
right (reversed) order, the boxes are painted as sequence  
c(yellow,pink,green,blue) instead of  
c(yellow,blue,green,pink).


I do not understand how to turn over a given order and with a given  
count of colours to the boxes.


See if this example using selected colors() works to make it clearer:

 colors()[(2:9)*10]
[1] bisque1 blue4   burlywood3  chartreuse3 coral3
[6] cyan2   darkgraydarkorange


bp5 - bwplot(voice.part ~ height, data = singer, main = 5 colors do  
work,

 panel = function(...) {
   panel.grid(v = -1, h = 0)
   panel.bwplot(fill=colors()[(2:9)*10], ...)
  })

bp5

(Needed to avoid the first colors() because they were mostly variants  
of white.

 colors()[1:8]
[1] white aliceblue antiquewhite  antiquewhite1
[5] antiquewhite2 antiquewhite3 antiquewhite4 aquamarine




Thanks in advance,
Rainer Hurling




--
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.


Re: [R] Colour filling in panel.bwplot from lattice

2010-11-02 Thread Rainer Hurling

On 02.11.2010 20:08 (UTC+1), David Winsemius wrote:


On Nov 2, 2010, at 2:32 PM, Rainer Hurling wrote:


On 02.11.2010 19:08 (UTC+1), David Winsemius wrote:

On Nov 2, 2010, at 1:19 PM, Rainer Hurling wrote:


Inspired by colouring the dots of box-whisker plots I am trying to
also fill the boxes (rectangles) with different colours. This seems
not to work as I expected.

Looking at the help page of panel.bwplot it says: 'fill - color to
fill the boxplot'. Obviously it is only intended to fill all boxes
with only one colour?

Nevertheless the following example shows, that 'fill' from
panel.bwplot is able to work with more than one colour. But this only
works with one colour or multiples of 5 colours:


-
bp1 - bwplot(voice.part ~ height, data = singer, main=1 color works,
panel = function(...) {
panel.bwplot(col=c(yellow),
fill=c(yellow), ...)
})

bp2 - bwplot(voice.part ~ height, data = singer, main = 3 colors do
NOT work,
panel = function(...) {
panel.bwplot(col=c(yellow,blue,green),
fill=c(yellow,blue,green), ...)
})

bp3 - bwplot(voice.part ~ height, data = singer, main = 5 colors do
work,
panel = function(...) {
panel.bwplot(col=c(yellow,blue,green,pink,red),
fill=c(yellow,blue,green,pink,red), ...)
})

plot(bp1, split=c(1,1,1,3))
plot(bp2, split=c(1,2,1,3), newpage=FALSE)
plot(bp3, split=c(1,3,1,3), newpage=FALSE)
-

Is there any chance to use more than one filling colour correctly?




Thanks for answering.


You have eight boxes to fill and 8 dots to color. You can either supply
8 distinct colors or you can supply some lesser number and they will be
recycled across the entire 8 boxes and dots. What you cannot do ( and
expect to see the dots against the fill background) is plot the dots as
the same colors as the fill.


It was not my intention to get the dots coloured in the same colour as
the boxes. Instead I am looking for a method to fill the boxes with a
predefined set of different colours (from a color vector). As far as I
can see this is only possible for one colour and multitudes of five
colours.


I think first I have to apologise for my bad english. Sorry for any 
misunderstandig.



Huh? My example used 4 colors. It should have worked with eight colors
as well. There are eight groups and


Yes, all is ok with your example. My only problem is, the these four 
colours are not ordered as given by the vector (see below).



The dots should remain uncoloured ...


Then leave out the col= argument (assuming uncolored means black.)


I used these coloured dots to explain, that ordered colours (from given 
vector) work with dots, but not with the boxes.



This will let you see all colors of dots and fill with only 4 colors
because I set it up so there was no two identical colors in teh sequence
of dots and fill during hte reculing:

bp4 - bwplot(voice.part ~ height, data = singer, main = 5 colors do
work,
panel = function(...) {
panel.bwplot(col=rev(c(yellow,blue,green,pink)),
fill=c(yellow,blue,green,pink), ...)
})


In your example you can see that the dots colors are painted in the
right (reversed) order, the boxes are painted as sequence
c(yellow,pink,green,blue) instead of
c(yellow,blue,green,pink).

I do not understand how to turn over a given order and with a given
count of colours to the boxes.


See if this example using selected colors() works to make it clearer:

  colors()[(2:9)*10]
[1] bisque1 blue4 burlywood3 chartreuse3 coral3
[6] cyan2 darkgray darkorange


bp5 - bwplot(voice.part ~ height, data = singer, main = 5 colors do
work,
panel = function(...) {
panel.grid(v = -1, h = 0)
panel.bwplot(fill=colors()[(2:9)*10], ...)
})

bp5

(Needed to avoid the first colors() because they were mostly variants of
white.
  colors()[1:8]
[1] white aliceblue antiquewhite antiquewhite1
[5] antiquewhite2 antiquewhite3 antiquewhite4 aquamarine


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.


I hope, this explaination is a bit clearer than my preceding ones.


Thanks in advance,
Rainer Hurling


__
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.


Re: [R] Colour filling in panel.bwplot from lattice

2010-11-02 Thread David Winsemius


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.





Thanks in advance,
Rainer Hurling


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.


Re: [R] Colour filling in panel.bwplot from lattice

2010-11-02 Thread Rainer Hurling

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.


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,
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.


Re: [R] Colour filling in panel.bwplot from lattice

2010-11-02 Thread David Winsemius


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.


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




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.


Rainer


David Winsemius, MD
West Hartford, CT




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.


Re: [R] Colour filling in panel.bwplot from lattice

2010-11-02 Thread Rainer Hurling

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.


Re: [R] Colour filling in panel.bwplot from lattice

2010-11-02 Thread Dennis Murphy
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 rhur...@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]]

__
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.