How to change order of boxplots when using ggplot2?

Have you tried this: df2$variable <- factor(df2$variable, levels = c(‘vph.shr’,’vnu.shr’),ordered = TRUE) I just picked an ordering there, since my system is configured slightly differently than yours I suspect, so my ‘default ordering’ may differ. But you can just switch the position of levels when specifying them. A few other options, depend on your tastes: … Read more

Plotting with ggplot2: “Error: Discrete value supplied to continuous scale” on categorical y-axis

As mentioned in the comments, there cannot be a continuous scale on variable of the factor type. You could change the factor to numeric as follows, just after you define the meltDF variable. meltDF$variable=as.numeric(levels(meltDF$variable))[meltDF$variable] Then, execute the ggplot command ggplot(meltDF[meltDF$value == 1,]) + geom_point(aes(x = MW, y = variable)) + scale_x_continuous(limits=c(0, 1200), breaks=c(0, 400, 800, … Read more