ggplots can use reorder
to sort variables based on things like alphabetical order, or y-axis value for a plot. However, my situation is a little more complex and I can't figure it out.
My simple plot has 3 values: the intensities of color#1, color#2, and combined.
My goal is to have "combined" ALWAYS appear in the 3rd place, regardless of its value.
How can I accomplish this? I can't sort alphabetically (because the names of color1 and color2 will differ in the future) and I cannot sort by intensity since the 'combined' value will not always relfect color1+color2.
Therefore I need a way to say, "if the name is 'combined' plot it in 3rd place on the x-axis"
library(ggplot2)
mydf <- data.frame("color"=c("blue","gold","combined"),"intensity"=c(10,5,6))
ggplot(mydf, aes(x=color, y=intensity)) + geom_point()