Hi Jim, sizetree was what I was looking for. I am going to play with the options a bit. Thanks a lot, Michele
On Nov 14, 2012, at 2:55 AM, Jim Lemon wrote: > On 11/14/2012 11:04 AM, michele caseposta wrote: >> Hi everyone, >> I have a certain number of samples and I want to visualize the groups those >> samples belong to. >> For example, suppose to have three variables, age, sex, and >> smoker/nonsmoker, and three samples, S1, S2, S3. >> S1 is 35, male, nonsmoker >> S2 is 24, female, nonsmoker >> S3 is 24, female, smoker >> >> at the end I have the following data frame: >> >> S1 S2 S3 >> age 35 24 30 >> sex M F F >> smk N N S >> >> What I would like is to see this represented in a matrix with colors >> representing the group the specific sample belongs to. In the example, Age >> would have three levels, sex and smoker/nonsmoker will have two. >> >> An example of what I would like to obtain is from the attached image (from >> The Cancer Genome Browser at UCSC) >> You can see the class of each sample represented by the color. >> Clearly here there are useless variables, like sample name, but the example >> gives an idea of what I would like to get. >> >> So far I was able to achieve a pseudo-result with colorbar.plot, but I find >> it hard to get the labels in the correct position, as it seems like I cannot >> find a way to automatically put them near each class bar >> >> Any suggestions other than colorbar.plot? >> > Hi michele, > Your picture didn't come thought, but it was fairly easy to find. I'm not > entirely sure about this, but are you looking for an hierarchic breakdown of > your variables? The illustration on the right side of your example looks like > this. Sizetrees provide such a breakdown by successive stacked bars, in which > each bar in the leftmost stack splits into its components, like smoke -> sex > -> age. Alternatively you can illustrate relationships like these with nested > bar plots, in which subcategories are nested within the superordinate > categories. See the sizetree and barNest functions in the plotrix package. > > 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.