Re: [R] graph: horizontal bar reflecting number of data

2016-07-15 Thread Dagmar
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, I want the names of the weeks on the x axis and the animals on the y-axis. Then, the shading of the

Re: [R] graph: horizontal bar reflecting number of data

2016-07-15 Thread Crump, Ron
Hi Dagmar, 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. If I understand the above correctly, and using the example dataset constructed by Ulrik: datframe <-

Re: [R] graph: horizontal bar reflecting number of data

2016-07-15 Thread Jim Lemon
Hi Dagmar, Maybe your want something like this? 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")) datframe datframe$numberdata<-as.numeric(as.character(datframe$numberdat)) library(plotrix)

Re: [R] graph: horizontal bar reflecting number of data

2016-07-15 Thread Ulrik Stervbo
Dear Dagmar, must the numberdata be character? Here are tew solutions. The first solution summarise before plotting and the second does everything in the plot library("dplyr") library("ggplot2") datframe <- data.frame(Name=c("Kati","Kati","Kati","Leon","Leon","Leon" ), week =c("1","2", "3",

Re: [R] graph: horizontal bar reflecting number of data

2016-07-15 Thread Dagmar
Dear all, dear Jim, Thank you for trying to help Jim. Unfortunately it didn't solve my problem. 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. Any help? Dagmar Am 13.07.2016

Re: [R] graph: horizontal bar reflecting number of data

2016-07-13 Thread Jim Lemon
Hi Tagmarie, This might help: datframe$numberdata<-as.numeric(as.character(datframe$numberdat)) library(plotrix) barcol<-color.scale(datframe$numberdat,extremes=c("black","white")) barplot(matrix(datframe$numberdat,nrow=2,byrow=TRUE), beside=TRUE, horiz=TRUE,names.arg=paste("Week",1:3),

[R] graph: horizontal bar reflecting number of data

2016-07-13 Thread Dagmar
Dear all, I hope someone can help with my problem: I have a dataframe like this: 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")) datframe I want to create a graph like the attached