I am trying to create panels laid out by panels during construction. For readability, I want to create a separate schedule for each set of four buildings. I would like the widths of the bars to be the same on all charts.
Ive tried using the width command. This works to adjust the width within a particular graph, but does not maintain uniform width in the graphs. It appears as if there was a rewrite function that fixes the width depending on the number of values โโof the Final variable. Does anyone know to fix the width so that it is the same on the graphs?
library(ggplot2) building <- c(1,1,1,2,5,4,5,4,2,3,1,4,3,5,5) Final <- c("Developing","Developing","Developing","Skilled","Skilled","Skilled","Skilled","Skilled","Skilled","Skilled","Skilled","Skilled","Skilled","Accomplished","Accomplished") mydata <- data.frame(building,Final) str(mydata) sub1 <- subset(mydata, building <= 4) sub2 <- subset(mydata, building == 5) p1 <- ggplot(sub1, aes(Final)) + geom_bar(aes(fill=Final),position="dodge",colour="black",width=0.4) + facet_wrap( ~ building,ncol=2) + coord_flip() p1 + xlab("Final Summative Rating") + scale_x_discrete(labels = c("","","","")) + scale_fill_manual( values=c("Ineffective" ="red2","Developing" ="darkgoldenrod2", "Skilled" = "olivedrab3","Accomplished"= "springgreen3")) + theme(strip.text.x = element_text(size = 7.5)) + ylab("Teacher Count") + labs(fill = "Rating") p2 <- ggplot(sub2, aes(Final)) + geom_bar(aes(fill=Final),position="dodge",colour="black",width=0.4) + facet_wrap( ~ building,ncol=2) + coord_flip() p2 + xlab("Final Summative Rating") + scale_x_discrete(labels = c("","","","")) + scale_fill_manual(values=c("Ineffective" ="red2","Developing" ="darkgoldenrod2", "Skilled" = "olivedrab3","Accomplished"= "springgreen3")) + theme(strip.text.x = element_text(size = 7.5)) + ylab("Teacher Count") + labs(fill = "Rating")