Hi,

I'm trying to plot bar graphs with stacked columns marked with  
askterisks for certain columns, which follow certain criteria.

I've gotten the stacked bar plots with Data set A (please refer to  
code below and plot attached).  However, I haven't figured how to put  
asterisks on columns based on some extra information (such as "used/ 
unused") as in Data set B i.e.  asterisks at the top of the Index1 and  
Index3 columns.


---- R code ----
title = 'frequency'
filename = 'testdata2.txt'
sample_output = 'sequences'
# read in data
my.data <- read.delim(filename, sep="\t")

# data from second column onward
my.dataM <- my.data[,2:ncol(my.data)]
# rownames in first column
rownames <- my.data[,1]

# define colours for the categories
col 
= 
c 
("red 
","orange 
","yellow 
","green 
","violet 
","cyan","blue","pink","peachpuff","tomato","seagreen","salmon")
my.dataNcol <- ncol(my.data[,2:ncol(my.data)])
my.dataColour <- col[1:my.dataNcol]
# colors() returns all the colours recognized by R

# a bar plot with stacked bars
if  (is.null(sample_output)) {
	pdf( "BarPlot.pdf")
} else {
     pdf(file=paste("BarPlot_", sample_output, ".pdf", sep="")) } 	
barplot(as.matrix(my.dataM),
   main=title,
   legend=rownames,
   col=c(my.dataColour)
)
dev.off()


------Dataset A: data used with code above------
""	"Index1"	"Index2"	"Index3"	
"matched"	0.819	0.174	0.007
"errors"	0.619	0.314	0.067
"unmatched"	0.479	0.385	0.136


------Dataset B: data intended to use -----
--(last row "used/unused" for determining whether to mark column with  
asterisk or not)---
""	"Index1"	"Index2"	"Index3"	
"matched"	0.819	0.174	0.007
"errors"	0.619	0.314	0.067
"unmatched"	0.479	0.385	0.136
"used/unused"	y	n	y

-------

Thanks,
Dorothy





	[[alternative HTML version deleted]]

