Reputation: 415
Hi I have a data table that I made into long form so that I have columnes for ID, Cluster.membership, Enrichment, Stimulation (UNS or 3S), cytokine.measured (test), values. I got stuck on the bar plot visualisation
I want to plot bar graph for each individual ID, compare its UNS vs 3S, for each cytokine measured, under each cluster. However my try on the bar chart was close but not good. You see I have stimulation conditions on X axis, and I have clusters and cytokine measured in groups. But all the values are the sum of all IDs, they are stacked.
Taking the top left corner plot as an example. Instead I want to see for Cluster 10, GMCSF, each distinct patient ID should be grouped, each give me 2 bars with UNS on the left next to a 3S on the right, then it should be next ID in the cluster, UNS 3S, then next ID in this cluster.
I know this might look busy, but each cluster will have less than 10 differnt IDs in it, so this way I can see if each individual ID sample all have the same increase or decreas in each cluster for a given cytokine measured.
assume my data
B2.long <- my data in long form
m <- ggplot(B2.long,aes(x=Stimulation, y=Values))+
geom_bar(position="dodge", stat="identity")+
facet_grid( Cluster.membership~cytokine.measured)
print(m)
Upvotes: 0
Views: 103