Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(ggplot2)
- library(reshape2)
- dat <- structure(list(Type = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
- 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L,
- 3L, 3L, 3L, 3L, 3L, 3L, 3L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
- 6L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L), .Label = c("High_expression",
- "KD.ip", "LG.ip", "LN.id", "LV.id", "LV.ip", "SP.id", "SP.ip"
- ), class = "factor"), ImmGen = structure(c(1L, 2L, 3L, 4L, 5L,
- 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
- 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L,
- 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L), .Label = c("Bcells",
- "DendriticCells", "Macrophages", "Monocytes", "NKCells", "Neutrophils",
- "StemCells", "StromalCells", "abTcells", "gdTCells"), class = "factor"),
- Exp_06hr = c(7174.40482999999, 23058.74882, 39819.39133,
- 15846.46146, 8075.78226, 105239.11609, 7606.34563, 19513.57747,
- 7116.51211, 6978.64995, 498.36828, 732.01788, 621.51576,
- 546.63461, 529.1711, 545.17219, 477.54658, 1170.50303, 550.99528,
- 607.56707, 775.0691, 1269.50773, 2138.69883, 1561.74652,
- 601.9372, 5515.59896, 744.48716, 997.32859, 639.13126, 657.64581,
- 4165.29899, 5465.1883, 7773.25723, 5544.86758, 3461.13442,
- 8780.64899, 4380.00437, 8721.84871, 3674.62723, 3911.00108,
- 2932.76554, 5903.48407, 6179.81046, 3683.64539, 2744.59622,
- 6760.37307, 4097.14665, 6845.31988, 2872.77771, 2912.84262
- ), Exp_24hr = c(1596.9091, 4242.52354, 9984.68861, 3519.18627,
- 1602.92511, 12203.57109, 1656.19357, 3389.93866, 1617.35484,
- 1579.00309, 715.47289, 643.98371, 689.40412, 580.26036, 608.22853,
- 695.10737, 830.77947, 670.34899, 640.67908, 637.47464, 356.75713,
- 393.13449, 549.60095, 466.76064, 336.95453, 617.20976, 339.2476,
- 469.57407, 292.86365, 305.45178, 2604.07605, 4210.64843,
- 5797.13123, 3650.88447, 2275.03269, 6475.27485, 2604.70614,
- 4796.3314, 2411.09694, 2458.23237, 1498.21516, 1996.6875,
- 2927.82836, 1911.00463, 1523.57171, 2199.62297, 1541.82034,
- 2815.82184, 1608.46099, 1588.80561), ExpDiff_06_24hr = c(5577.49572999999,
- 18816.22528, 29834.70272, 12327.27519, 6472.85715, 93035.545,
- 5950.15206, 16123.63881, 5499.15727, 5399.64686, -217.10461,
- 88.03417, -67.88836, -33.62575, -79.05743, -149.93518, -353.23289,
- 500.15404, -89.6838, -29.9075700000001, 418.31197, 876.37324,
- 1589.09788, 1094.98588, 264.98267, 4898.3892, 405.23956,
- 527.75452, 346.26761, 352.19403, 1561.22294, 1254.53987,
- 1976.126, 1893.98311, 1186.10173, 2305.37414, 1775.29823,
- 3925.51731, 1263.53029, 1452.76871, 1434.55038, 3906.79657,
- 3251.9821, 1772.64076, 1221.02451, 4560.7501, 2555.32631,
- 4029.49804, 1264.31672, 1324.03701)), .Names = c("Type",
- "ImmGen", "Exp_06hr", "Exp_24hr", "ExpDiff_06_24hr"), row.names = c(NA,
- -50L), class = "data.frame")
- dat.m <- melt(dat)
- setwd("~/Desktop/")
- pdf("myfig.pdf",width=30,height=20)
- p <- ggplot(dat.m,aes(ImmGen,value)) +
- geom_bar(aes(fill = variable),position = "dodge",stat="identity")+
- facet_wrap(~Type)
- p
- dev.off();
- dat$rank <- rank(dat$ExpDiff_06_24hr)
- dat.m <- melt(dat, id = c("Type","ImmGen","rank"))
- dat.t <- transform(dat.m, TyIm = factor(paste0(Type, ImmGen)))
- dat.t <- transform(dat.t, TyIm = reorder(TyIm, rank(rank)))
- p <- ggplot(dat.t, aes(TyIm,value)) +
- geom_bar(aes(fill = variable), position = "dodge", stat="identity")+
- facet_wrap(~Type, ncol=1, scales="free") +
- scale_x_discrete("ImmGen", breaks=dat.t$TyIm, labels=dat.t$ImmGen)
- p
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement