[R] Unusual graph- modified wind rose perhaps?

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Mon Jul 4 14:14:30 CEST 2011


Dear John,

You can get pretty close with ggplot2.

Best regards,

Thierry

library(ggplot2)
dataset <- data.frame(Name = LETTERS[1:26])
dataset$Score <- runif(nrow(dataset))
dataset$Category <- cut(dataset$Score, breaks = c(-Inf, 0.33, 0.66, Inf), labels = c("Bad", "Neutral", "Good"))
dataset$Name <- factor(dataset$Name, levels = dataset$Name[order(dataset$Score)])
dataset$Location <- as.numeric(dataset$Name)

ggplot(dataset, aes(x = Name, y = Score, fill = Category)) + geom_bar() + coord_polar()


#with some extra tweeking
dataset <- rbind(dataset, 
	data.frame(
		Location = c(max(dataset$Location) + seq_len(max(dataset$Location) / 2), min(dataset$Location) - seq_len(max(dataset$Location) / 2)),
		Name = "",
		Score = 0,
		Category = "Good"
	)
)
ggplot(dataset, aes(x = Location, y = Score, fill = Category)) + geom_bar(stat = "identity") + coord_polar(start = pi, direction = -1) + scale_fill_manual(value = c(Good = "green", Neutral = "grey", Bad = "red")) + theme_bw() + scale_x_continuous("", breaks = dataset$Location, labels = dataset$Name)

----------------------------------------------------------------------------
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey


> -----Oorspronkelijk bericht-----
> Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
> Namens John Kane
> Verzonden: maandag 4 juli 2011 13:22
> Aan: r-help op r-project.org
> Onderwerp: [R] Unusual graph- modified wind rose perhaps?
> 
> 
> In a OpenOffice.org forum someone was asking if the spreadsheet could graph
> this http://www.elmundo.es/elmundosalud/documentos/2011/06/leche.html
> 
> I didn't think it could. :)
> 
> I don't think I've ever seen exactly this layout. Does anyone know if there is
> anything in R that does a graph like this or that can be adapted to do it.
> 
> Unfortunately my Spanish is non-existent so I am not sure how effective the
> graph is in achieving whatever it's suppposed to do.  A dot chart might be as
> effective but it is a flashy graphic.
> 
> Thanks
> 
> ______________________________________________
> R-help op 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