Closed SEvisual closed 8 months ago
@bioinformzhang, I didn't create tornado
with plots like this in mind. It doesn't seem like the plot you showed is really a model sensitivity plot, is it? It seems like simple experimental results. Let me know if I am wrong about that.
This is how I would create a plot like the one you showed...
require(ggplot2)
require(dplyr)
X <- data.frame(value = 1:12,
metric = rep(c("Background1", "Hypo DMR", "Background2", "Hyper DMR"), each=3),
parameter = rep(c("Promoter", "3UTR", "5UTR"), times = 4))
g1 <- ggplot(X %>% dplyr::filter(metric %in% c("Background1", "Hypo DMR")),
aes(x = parameter, y = value, group = metric, fill = metric)) +
geom_bar(position = "dodge", stat = "identity") +
coord_flip() +
labs(x = "", y = "value", fill = "") +
scale_y_continuous(limits = c(0, 13)) +
theme(legend.position = "bottom",
axis.text.y = element_text(hjust = 0.5),
plot.margin = grid::unit(c(5.5, 5.5, 5.5, 0), "points"))
g2 <- ggplot(X %>% dplyr::filter(metric %in% c("Background2", "Hyper DMR")),
aes(x = parameter, y = value, group = metric, fill = metric)) +
geom_bar(position = "dodge", stat = "identity") +
coord_flip() +
labs(x = "", y = "value", fill = "") +
scale_y_continuous(limits = c(13, 0), trans = scales::reverse_trans()) +
theme(legend.position = "bottom",
axis.text.y = element_blank(),
axis.ticks.y.left = element_blank(),
plot.margin = grid::unit(c(5.5, 0, 5.5, 5.5), "points"))
plot(gridExtra::arrangeGrob(g2, g1, nrow = 1, widths = c(4, 5)))
I would like to create a dual-sided bar chart with text in the middle. How can I achieve this using tornado packages? Thank you very much