[R] graph: horizontal bar reflecting number of data
Crump, Ron
R.E.Crump at warwick.ac.uk
Fri Jul 15 12:48:27 CEST 2016
Hi Dagmar,
<quote>
I want the names of the weeks on the x axis and the animals on the y-axis.
Then, the shading of the barplot is supposed to represent the number of
data
per week.
</quote>
If I understand the above correctly, and using the example dataset
constructed by Ulrik:
datframe <- data.frame(Name=c("Kati","Kati","Kati","Leon","Leon","Leon"
+ ), week =c("1","2", "3", "1","2", "3"), numberdata =c(5,12, 1,
+ 6,2, 5))
I think this might do the job:
library(ggplot)
ggplot(datframe)+geom_tile(aes(x=week,y=Name,fill=numberdata))
Regards,
Ron.
More information about the R-help
mailing list