Bars arranged in descending order and using facet grid

Viewed 30

I am trying to create a graph like this but I cannot arrange the bars in descending order for the each county name. The top heading has to be the value and side headings are based on the variable perform. Plus, I cannot figure out as to how to make the graphs neat. The percentages should appear nicely. My code:

graph <- ggplot(Data,aes(x=name,y=percentage,fill=Benefits)) +
  geom_col(position="dodge", width=0.8) +
  geom_text(aes(label=percentage)

graph2 <- title.plot(graph) + facet_grid(perform~value,scales="free")+
  theme(legend.position="bottom")+ylab("%")

Example of the data:

structure(list(name = c("AZ", "AZ", "AZ", "AZ", "NY", "NY", "NY", 
"NY", "FL", "FL", "FL", "FL", "NJ", "NJ", "NJ", "NJ"), perform = c("Low", 
"Low", "High", "High", "High", "Low", "Low", "High", "High", 
"Low", "High", "Low", "Low", "High", "Low", "High"), Benefits = c("Equal Wage for both the sexes", 
"Migration", "Employment Provided", "Delayed Employment", "Equal Wage for both the sexes", 
"Migration", "Employment Provided", "Delayed Employment", "Delayed Employment", 
"Equal Wage for both the sexes", "Migration", "Employment Provided", 
"Equal Wage for both the sexes", "Migration", "Employment Provided", 
"Delayed Employment"), percentage = c(83, 22, 5, 97, 62, 53, 
40, 64, 78, 69, 27, 77, 18, 92, 11, 9), var = c("Worked", "Worked", 
"Worked", "Worked", "Worked", "Worked", "Worked", "Worked", "Worked", 
"Worked", "Worked", "Worked", "Worked", "Worked", "Worked", "Worked"
), value = c("Not Worked", "Not Worked", "Not Worked", "Worked", 
"Not Worked", "Not Worked", "Not Worked", "Worked", "Not Worked", 
"Not Worked", "Not Worked", "Worked", "Worked", "Worked", "Not Worked", 
"Not Worked"), Covid = c("Worked in Covid", "Not Worked in Covid", 
"Not Worked in Covid", "Not Worked in Covid", "Not Worked in Covid", 
"Not Worked in Covid", "Not Worked in Covid", "Not Worked in Covid", 
"Not Worked in Covid", "Not Worked in Covid", "Not Worked in Covid", 
"Not Worked in Covid", "Not Worked in Covid", "Not Worked in Covid", 
"Not Worked in Covid", "Not Worked in Covid")), class = c("tbl_df", 
"tbl", "data.frame"), row.names = c(NA, -16L))

enter image description here

0 Answers
Related