I have code like this:
data <- read.csv("test2.csv", stringsAsFactors=FALSE, header=TRUE)
facet_plot <- ggplot(data, aes(x = specie, y = value, fill = specie)) +
geom_bar(stat = "identity", position = "dodge") +
scale_fill_manual(values=c("#3288bd", "#d53e4f", "#fc8d59", "#fee08b")) +
ylab("Performance (ns/day) on Tesla P100")+
facet_grid(. ~ condition, switch="both") +
theme(plot.title = element_text(hjust = 0.5),
axis.title.y = element_text(face="bold", colour="black", size = 12),
legend.title = element_text(face="bold", size = 10),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.ticks.x=element_blank(),
axis.title.x = element_blank(),
axis.text.x=element_blank(),
strip.background = element_rect(fill="grey", colour="black", size=1),
strip.text = element_text(face="bold", size=rel(1.2)))
# Call facet plot:
facet_plot + guides(fill=guide_legend(title="GROMACS command")) + scale_y_continuous(expand = c(0,0), limits = c(0,460))
My data looks like this:
> dput(data)
structure(list(specie = c("gmx mdrun -s benchMEM.tpr -nsteps 10000",
"gmx mdrun -s benchMEM.tpr -nsteps 10000", "gmx mdrun -s MD_5NM_WATER.tpr -nsteps 10000 ",
"gmx mdrun -s MD_5NM_WATER.tpr -nsteps 10000 ", "gmx mdrun -s MD_10NM_WATER.tpr -nsteps 10000 ",
"gmx mdrun -s MD_10NM_WATER.tpr -nsteps 10000 ", "gmx mdrun -s MD_15NM_WATER.tpr -nsteps 10000 ",
"gmx mdrun -s MD_15NM_WATER.tpr -nsteps 10000 "), condition = c("CUDA",
"SYCL", "CUDA", "SYCL", "CUDA", "SYCL", "CUDA", "SYCL"), value = c(54.682,
77.649, 452.48, 158.277, 81.426, 80.454, 33.449, 34.363)), class = "data.frame", row.names = c(NA,
-8L))
How to order bars in this order: MD_5NM_WATER, MD_10NM_WATER, MD_15NM_WATER, benchMEM?