Hi! I am trying to use ggplot2 to create a stacked bar plot. Previously I tried using barplot() but gave up because of problems with the positioning of the legend and other appearance problems. I am now trying to learn ggplot2 and use it for all the plots that I need to create for my dissertation.
I am able to create normal bar plots using ggplot2, but I am stomped with the stacked bar plots. This works: barplot(t(file.codes), beside = FALSE) the data.frame file.codes looks like this ..... code.1 code.2 code.3 code.4 code.5 .... file.1 2 0 0 5 4 .... file.2 3 18 1 0 2 .... .... I would like each file to be a bar and then each code stacked for each file. By transposing the file.codes data.frame barplot() will allow me to do so. I am trying to obtain the same result in ggplot2 but i think that qplot wants the data to be like this: file.1 code.1 2 file.1 code.2 0 file.1 code.3 0 file.1 code.4 5 file.1 code.5 4 file.2 code.1 3 file.2 code.2 18 .... I think that I need to use the package "reshape", but I am not sure whether to use cast(), melt(), or recast() and how to set up the function. Thanks, Henri-Paul -- Henri-Paul Indiogine Curriculum & Instruction Texas A&M University TutorFind Learning Centre Email: hindiog...@gmail.com Skype: hindiogine Website: http://people.cehd.tamu.edu/~sindiogine ______________________________________________ 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.