[R] graph: horizontal bar reflecting number of data

Dagmar Ramgad82 at gmx.net
Fri Jul 15 22:29:38 CEST 2016


Ron: That was exactly what I was looking for!

Thank you Ron!

Also thanks to Ulrik and Jim who tried to help. I learned a lot!

Dagmar


Am 15.07.2016 um 12:48 schrieb Crump, Ron:
> 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