Coding/R

ggplot2(pie chart)

jjbang 2012. 9. 7. 11:47

data

Type Mapped upmapped
GSE 29642 625
GPL 4608 3519
GDS 2720 1
GSM 694599 14528
IDF 948 30
ADF 297 2151
SDRF 883 28





code

library(reshape2) # data 형태 변환

library(ggplot2)

setwd("C:\\Users\\jjbang\\Desktop\\GEE paper\\data\\")

f = read.table("mp.txt", header=TRUE,sep='\t')

tt = melt(f)

p <- ggplot(tt, aes(x = factor(1), y = value, fill = variable)) 

p = p +  geom_bar(width = 1) + coord_polar(theta = "y") + facet_wrap(~Type, scales = "free_y")

p = p+ scale_fill_manual(values=c("#191970", "#CAE1FF"))

p = p + opts(title = "mapping result of GEE when using ontology", legend.title=theme_blank())

p = p + xlab(" ") + ylab(" ")

p