[R] Help on drawing stars and radars in R (update)

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Jun 11 17:55:27 CEST 2009



Barry Rowlingson wrote:
> On Thu, Jun 11, 2009 at 10:01 AM, Caroline
> Gideon-Adeniyi<c.gideon-adeniyi1 at fashion.arts.ac.uk> wrote:
>> Hi
>>
>> I don't know if you can help. I am a 2nd year Bsc Cosmetic Science student and in R I need some help in drawing stars.
>>
>> The problem that I have is I want to recreate a radar diagram similar to the one in excel.
>>
>> I have put in these commands in a script window:
>>
>>  stars(shampoo1[, 1:6], locations = c(0,0), radius = TRUE,
>>  key.loc=c(0,0),
>>  main = "Ranked Results for the Sensory Evaluation of the Shampoo" ,
>>  frame.plot = TRUE,
>>  key.labels = c("Foam Texture", "Skin Feel", "Rinsability", "Wet Combability", "Wet Feel", "Odour"),
>>  lty = 2,
>> )
>>
>> This gives me a black and white radar which is fine.
>>
>> Now according to the reference manual to colour the stars i need to add:
>>
>> col.stars = rainbow (30)
>>
>> Which colours in each star segment. The problem I have with this is that the segments are filled with colour and the segments overlap each other and each segment is not visible.
>>
>> So I desperately need the command that only colours the outline of the segments or stars instead of  filling it.
>>
>> This is the example given in the reference manual:
>>
>> stars(mtcars[, 1:7], locations = c(0,0), radius = FALSE,
>> key.loc=c(0,0), main="Motor Trend Cars", lty = 2)
>>
>>
>> Can u help?
> 
>  The stars are drawn using R's polygon function, and that has two
> colours - the fill colour and the border colour. It seems that the
> stars function only lets you set the fill colour and not the border
> colour which is what you want.
> 
>  It is possible to modify the stars function to also set the border
> colour, but that can be a bit beyond beginners skills. I reckon
> someone on this list will come up with a modified stars() function
> before the end of the day that does it. It might be me, if it wasn't
> for the fact I have other things I should be doing!


OK, if Caroline requests more help here, we are probably both willing to 
add change the two lines of code.


>  All that needs doing is to add a col.border argument to stars, and
> then make sure border= is used when stars calls polygon. I've half
> done it already.
> 
>  Is this the first use of R in cosmetic science? 

At least I heard of studies like clinical trials by cosmetic companies 
to proof that some lotions/shampoos really increase some features of 
your skin/hair, Barry.
Well, perhaps I am buying the wrong shampoo and should look at the 
statistics here since the amount of my hair has been reduced 
significantly over the last couple of years.
This does not mean I want to encourage people to send shampoo 
commercials to R-help or my mail address.

Best,
Uwe




 > Maybe next time I see
> a shampoo advert on TV and they do the 'here comes the science' bit,
> we'll see a plot made in R...
> 
>  Barry
> 
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list