Open dpastoor opened 7 years ago
Also drop the NA control on the legend. Plot still could have more work done, but gist is there.
credit to @vjd
library(tibble) library(dplyr) library(ggplot2) df <- tribble( ~p50, ~trt, ~wtbin, 0.05541562, "control", NA, 0.27149321, "test1", ">=65-90 kg", 0.24087591, "test1", ">=90 kg", 0.25974026, "test1", "< 65 kg", 0.26923077, "test2", ">=65-90 kg", 0.24087591, "test2", ">=90 kg", 0.25974026, "test2", "< 65 kg", 0.27149321, "test3", ">=65-90 kg", 0.24087591, "test3", ">=90 kg", 0.25974026, "test3", "< 65 kg" ) cols <- c(">=65-90 kg"="#F8766D",">=90 kg"="#00BA38", "< 65 kg"="#00BFC4") ggplot(data=df, aes(x = trt, y = p50, fill = wtbin)) + geom_bar( position = "dodge", stat = "identity", size=1.5, color="#333333" )+ geom_label(aes(y = p50 + 0.05,x=trt, label=round(p50,2)), position = position_dodge(1), fontface = "bold" )+ theme_bw()+ scale_y_continuous(limits=c(0,1),breaks = seq(0,1,0.1),expand=c(0,0))+ PKPDmisc::base_theme(axis_text_x = 16, legend_text = 16, axis_title_x = 18)+ theme(axis.title.x = element_blank(), panel.grid.major = element_blank()) + scale_fill_manual(breaks = names(cols), values = cols)
TODO
to add to ggvisualizer
example plot in question
Also drop the NA control on the legend. Plot still could have more work done, but gist is there.
credit to @vjd
TODO