# Using multiple variables continues to wrap the long ribbon of# plots into 2d - the ribbon just gets longer# d + facet_wrap(~ color + cut)# To change plot order of facet wrap,# change the order of varible levels with factor()diamonds$color<-factor(diamonds$color,levels=c("G","J","D","E","I","F","H"))# Repeat first example with new orderd<-ggplot(diamonds,aes(carat,price,fill=..density..))+xlim(0,2)+stat_binhex(na.rm=TRUE)+theme(aspect.ratio=1)d+facet_wrap(~color)

# You can choose to keep the scales constant across all panels# or vary the x scale, the y scale or both:p<-qplot(price,data=diamonds,geom="histogram",binwidth=1000)p+facet_wrap(~color)