[R] horizontal grouped stacked plots and removing space between bars

Ana Marija @okov|c@@n@m@r|j@ @end|ng |rom gm@||@com
Wed Jun 28 17:59:54 CEST 2023


I have code like this:

    data <- read.csv("test1.csv", stringsAsFactors=FALSE, header=TRUE)
# Graph
myplot=ggplot(data, aes(fill=condition, y=value, x=condition)) +
    geom_bar(position="dodge", stat="identity", width=0.5) +
    scale_fill_manual(values=c("#7b3294", "#c2a5cf", "#a6dba0", "#008837"))+
    ylab("Performance (ns/day)") +
    facet_wrap(~specie,nrow=3, labeller = label_wrap_gen(width = 85),
strip.position="bottom") +
   theme_bw() +
   theme(panel.grid = element_blank(),
        panel.spacing = unit(0, "mm"),
        legend.title=element_blank(),
        axis.title.x = element_blank(),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        panel.background = element_blank(),
        axis.ticks.x=element_blank(),
        axis.title.y = element_text(angle = 90, hjust = 0.5))



myplot + theme(panel.grid.major = element_blank(), panel.grid.minor =
element_blank(), legend.title=element_blank(),
panel.background = element_blank(), axis.title.x = element_blank(),
axis.text.x=element_blank(), axis.ticks.x=element_blank(),
axis.title.y = element_text(angle = 90, hjust = 0.5))

And my data is this:

> dput(data)
structure(list(specie = c("gmx mdrun -gpu_id 1 -ntomp 16 -s
benchMEM.tpr -nsteps 10000", "gmx mdrun -gpu_id 1 -ntomp 16 -s
benchMEM.tpr -nsteps 10000", "gmx mdrun -gpu_id 1 -ntomp 16 -s
benchMEM.tpr -nsteps 10000", "gmx mdrun -gpu_id 1 -ntomp 16 -s
benchMEM.tpr -nsteps 10000", "gmx mdrun -gpu_id 1 -ntomp 16 -s
MD_15NM_WATER.tpr -nsteps 10000", "gmx mdrun -gpu_id 1 -ntomp 16 -s
MD_15NM_WATER.tpr -nsteps 10000", "gmx mdrun -gpu_id 1 -ntomp 16 -s
MD_15NM_WATER.tpr -nsteps 10000", "gmx mdrun -gpu_id 1 -ntomp 16 -s
MD_15NM_WATER.tpr -nsteps 10000"), condition = c("Tesla P100-SYCL",
"Tesla V100-SYCL", "Tesla P100-CUDA", "Tesla V100-CUDA", "Tesla
P100-SYCL", "Tesla V100-SYCL", "Tesla P100-CUDA", "Tesla V100-CUDA"),
value = c(75.8, 77.771, 63.297, 78.046, 34.666, 50.052, 32.07,
59.815)), class = "data.frame", row.names = c(NA, -8L))

How do I:

   1. have these two plots next to each other, not on the top of each other
   2. How do I remove spaces between those bars?

	[[alternative HTML version deleted]]



More information about the R-help mailing list