I have a dataframe enrichment_df
that looks like this
meclocycline pimozide isocorydine alvespimycin
day1_d
Whenever using ggplot
you should have your data in long format:
enrichment_df[ "day" ] <- rownames(enrichment_df)
df.molten <- melt( enrichment_df, id.vars="day", value.name="Enrichment", variable.name="Antibiotics" )
head(df.molten)
day Antibiotics Enrichment
1 day1_day3__sham3_strict_enrichment meclocycline -0.869
2 hour4_day1_day3__sham3_strict_enrichment meclocycline -0.294
3 day7_day14__sham3_strict_enrichment meclocycline -0.333
This can be plotted by
ggplot(df.molten, aes( x = Antibiotics, y = Enrichment, fill = day ) ) +
geom_bar( position = "identity", stat = "identity", alpha = .3 )
I'm not sure though if position = "identity"
with negative values is what you are looking for.