我想重现此图表
使用rCharts因为我希望添加工具提示。这是这个ggplot图表的代码:
auto_cols <- sample(x = colors(), size = 96)
well_letters <- rep(LETTERS[1:8], each = 12)
tt <- data.frame(Well = factor(c(well_letters),rev(unique(well_letters))),
ncols = factor(c(1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,
12,1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,
11,12,1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,
10,11,12,1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,
9,10,11,12)),
Gene_Symbol = factor(c(NA,"AUV1","AUV2","AUV3","AUV4","AUV5","AUV6","AUV7","AUV8","AUV9","AUV10",NA,NA,"AUV13","AUV14","AUV15","AUV16","AUV17","AUV18","AUV19","AUV20","AUV21","AUV22",NA,NA,"VH1","VH2","VH3","VH4","VH5","VH6","VH7","VH8","VH9","VH10",NA,NA,"GH3","GH4","GH5","GH6","GH7","GH8","GH9","GH10","GH11","GH12",NA,NA,"JUI2","JUI3","JUI4","JUI5","JUI6","JUI7","JUI8","JUI9","JUI10","JUI11",NA,NA,"BKJ2","BKJ3","BKJ4","BKJ5","BKJ6","BKJ7","BKJ8","BKJ9","BKJ10","BKJ11",NA,NA,"CVG3","CVG4","CVG5","CVG6","CVG7","CVG8","CVG9","CVG10","CVG11","CVG12",NA,NA,"GH40","GH41","GH42","GH43","GH44","GH45","GH46","GH47","GH48","GH49",NA)),
Sequence =(c(NA,"CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC",NA,NA,"CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC",NA,NA,"CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC",NA,NA,"CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC",NA,NA,"CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC",NA,NA,"CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC",NA,NA,"CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC",NA,NA,"CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC","CAUCUGACC",NA)),auto_cols = auto_cols)
ggplot(tt, aes(y = Well, x = ncols)) +
geom_point(aes(colour = Gene_Symbol), size =8) +
guides(col = guide_legend(nrow = 10, ncol = 10)) +
scale_color_manual(values = auto_cols) +
geom_text(aes(label = Gene_Symbol, size = 150, vjust = 2), show_guide=FALSE) +
xlab(NULL) + ylab(NULL) + theme(legend.position="none")`
对于rCharts图,我会做这样的事情
但并不完美!
这是rchart代码
r1 <- rPlot(y = list(var='Well',sort="Well") ,x = 'ncols',
data = tt, type = "point", color = 'Gene_Symbol', size = list(const = 8),
tooltip = "#! function(item){return 'Sequence :' + item.Sequence +'//'+'Gene_Symbol :'+ item.Gene_Symbol} !#")
r1$set(legendPosition = 'none')
r1$guides(x = c(min = 0, max = 13))
有人可以做得更好