我的数据是
> data
width variable value
1 200 mappedEnsemblTx 110
2 400 mappedEnsemblTx 392
3 600 mappedEnsemblTx 1055
4 800 mappedEnsemblTx 2615
5 1000 mappedEnsemblTx 5201
101 200 UnmappedEnsemblTx 3927
102 400 UnmappedEnsemblTx 5175
103 600 UnmappedEnsemblTx 3220
104 800 UnmappedEnsemblTx 4856
105 1000 UnmappedEnsemblTx 7130
当我绘制这个时,我可以在我的图中看到三个或四个条而不是两个条。最小代码如下:
library(ggplot2)
g = ggplot(dat.melt,aes(x=factor(width),y=value,fill=variable), format(scientific=FALSE))
g = g + geom_bar(stat='identity',position='dodge')
g <- g + theme_bw()
g = g + opts(axis.text.x=theme_text(angle=-90, hjust=0, size = 16), axis.text.y=theme_text(size=16))
g <- g + opts(axis.title.x = theme_text(size=18), axis.title.y = theme_text(size=18, angle=90) )
g = g + scale_x_discrete('Total widths of the Ensembl Transcripts') + scale_y_continuous(name = 'Count')
g = g + coord_cartesian(ylim = c(0,7000))
谢谢