Data
is a data.frame that has the TCGA barcodes in a column called "barcodes", relative percentage in a column called "percent", and cell types in "cell_types."
if(!require("tidyverse")) install.packages("tidyverse")
library(ggplot2)
ggplot(data, mapping = aes(x = barcodes, y = percent, fill = cell_types)) +
geom_bar(position= "stack", stat = "identity")
EDIT: In case you want to change the colors of the cell_types, you can add scale_fill_manual
with labels being the names of the cell-types, and values being the color hex code you want:
ggplot(data, mapping = aes(x = barcodes, y = percent, fill = cell_types)) +
geom_bar(position= "stack", stat = "identity") +
scale_fill_manual(labels = c("cell_type1", "cell_type2", "cell_type3"), values = c("#000000", "#000000", "#000000"))
Can you repost the image? It's not showing up.
Reposted the image, sorry!