Dear All
How can one extend Brian Shine’s example if instead of using color for bar chart, I wanted to obtain bars with stripped pattern instead of color. I think Brian ‘s data can be used to illustrate this. I am new to ggplot .
Webster
From: ggp...@googlegroups.com [mailto:ggp...@googlegroups.com]
On Behalf Of Brian Shine
Sent: Wednesday, January 02, 2013 6:11 PM
To: Roman Luštrik
Cc: Brian Shine; ggp...@googlegroups.com
Subject: Re: Mathematical symbols in legends
Here are the data:
aghb <- data.frame(GHB = rep(1:4,3), Age = rep(1:3, each = 4), R = c(91.9, 79.1, 91.5, 104.6, 126.5, 144.6, 156.9, 187.8, 225.8, 257.3, 230.6, 241.2) )
and here's the code to produce bar chart.
labs <- list("<6.5%", "<7.5%", "<8.5%", expression("" >= 8.5))
labs2 <- list("<45", "<65", expression("" >= 65))
exp2 <- expression("" >= 8.5)
p1 <- ggplot(aghb, aes(x = factor(GHB), y = R, fill = factor(Age, labels = labs2))) + geom_bar(position = "dodge", stat = "identity") + labs(title = "Mortality rate by HbA1c and age in patients on renal replacement therapy", x = "HbA1c (%)", y = "Mortality / 1000 patient years", fill = "Age")
p1 + scale_x_discrete(labels=labs)
That gives me the following:
On 13-01-03 04:40 AM, Kasongo, Webster wrote:
> Dear All
>
> How can one extend Brian Shine’s example if instead of using color for
> bar chart, I wanted to obtain bars with stripped pattern instead of
> color. I think Brian ‘s data can be used to illustrate this. I am new
> to ggplot .
>
> Webster
>
I don't think this is possible in ggplot.
http://stackoverflow.com/questions/7604785/pattern-fills-for-graphs-in-r
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
Good to know it is not possible in ggplot and thanks for the history lesson from Dr.Greg Snow.
Webster