whats the best way to invert the legend label order so the 7 is down and the 1 is upstairs?
df$day <- as.numeric(df3$day)
blues <- colorRampPalette(c('#132B43', '#56B1F7'))
p4 <-
ggplot(subset(df,feedback==1&stp>20), aes(x=correct, fill=day, colour=day)) +
geom_histogram(colour="black", binwidth=10) +
facet_grid(day ~ .) +
ggtitle("Over-pronation histogram") +
ylab("Count (150s period)") +
xlab("% Steps in over-pronation") +guide_legend(reverse = false)
If you're putting it in numeric and it's a continuous scale, you're better off with
scale_fill_continuous(trans = 'reverse')
orscale_colour_continuous
. Using your code, this would give:For continuous scales,
guide_colorbar
is required.Here I reverse color direction. Then I reverse color and size order with different functions
Your code is quite strange, with
false
instead ofFALSE
and incorrectly placedguide_legend
. The correct usage is (@Harpal gives a hint on that):