Re: [R] Gantt chart but slightly different
Beata Czyz wrote: Hello, I am new to this list and rather new to graphics with R. I would like to make a chart like Gantt chart, something like that: ... but I would like to fill the different blocks of tasks with different pattern i.e. first blocks of Male 1 and Male 2 with pattern 1, second blocks of Male 1 and Male 2 with pattern 2 etc. Any idea? Hi Beata, This could be done by replacing the "taskcolors" argument in the "gantt.chart" function with an "angle" argument and passing that argument to the "rect" function that draws the bars. You could then get hatching of different directions instead of colors. Like this: gantt.chart<-function(x=NULL,format="%Y/%m/%d",xlim=NULL, angle=c(45,45,90,90,135,135), priority.legend=FALSE,vgridpos=NULL,vgridlab=NULL,vgrid.format="%Y/%m/%d", half.height=0.25,hgrid=FALSE,main="",xlab="",cylindrical=FALSE) { (a great chunk of the gantt.chart function) rect(x$starts[x$labels==tasks[i]],topdown[i]-half.height, x$ends[x$labels==tasks[i]],topdown[i]+half.height, angle=angle[i],border=FALSE) (the rest of the gantt.chart function) Jim __ R-help@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.
[R] Gantt chart but slightly different
Hello, I am new to this list and rather new to graphics with R. I would like to make a chart like Gantt chart, something like that: require (plotrix) Ymd.format<-"%Y/%m/%d" gantt.info<-list(labels=c("Male 1","Male 1","Male 1", "Male 2", "Male 2"), starts=as.POSIXct(strptime(c("2004/01/01","2004/04/03","2004/05/06", "2004/03/05", "2004/05/20"),format=Ymd.format)), ends=as.POSIXct(strptime(c("2004/03/03","2004/04/20", "2004/05/29", "2004/05/06", "2004/06/10"), format=Ymd.format)), priorities=c(1,2)) vgridpos<-as.POSIXct(strptime(c("2004/01/01","2004/02/01","2004/03/01", "2004/04/01","2004/05/01","2004/06/01","2004/07/01","2004/08/01", "2004/09/01","2004/10/01","2004/11/01","2004/12/01"),format=Ymd.format)) vgridlab<-c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") gantt.chart(gantt.info,main="", priority.legend=FALSE,vgridpos=vgridpos,vgridlab=vgridlab,hgrid=FALSE, taskcolors=NULL, cylindrical=FALSE) but I would like to fill the different blocks of tasks with different pattern i.e. first blocks of Male 1 and Male 2 with pattern 1, second blocks of Male 1 and Male 2 with pattern 2 etc. Any idea? Bests, Beata __ R-help@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.