therefore, I have a simple example - a completely cross-section of three experimental experimental studies, where the continuous effect was measured for each treatment pair. I want to order each treatment individually according to each context, but I am stuck on ggplot faceting.
here is my data
df <- data.frame(treatment = rep(letters[1:3], times = 3), context = rep(LETTERS[1:3], each = 3), effect = runif(9,0,1))
and I can get something very close if I break down the appeal and context into one 9-point scale, as such:
df$treat.con <- paste(df$treatment,df$context, sep = ".") df$treat.con <- reorder(df$treat.con, -df$effect, ) ggplot(df, aes(x = treat.con, y = effect)) + geom_point() + facet_wrap(~context, scales="free_x", ncol = 1)

besides achieving a separate order in each face, the new x variable that I created is potentially misleading, because it does not show that we used the same call in all three contexts.
Is this solved by manipulating the underlying factor, or is there a ggplot command for this situation?
tomw
source share