0

I have a csv file with following data format

963669136  solved   lost_village desc
948902923  rejected donations      desc
208285984  open     lost_village   desc
208285984  solved   lost_village   desc
268433965  solved   lost_village   desc
464273209  open     feedback       desc
464273209  solved   feedback       desc
2571706944 solved   victory_points desc

I acquire the info in the following way

tickets = read.csv("~/materials/minor/hw02/data/tickets_new.csv")

I want to produce a stacked percent bar chart. However, I can only get this far:

ggplot() +  
geom_bar(data = game_tag, aes(x = tag, fill = status)) +
  coord_flip() 

The Bar chart I get How can I make it percents on y instead of count. I want the result looking something like that

Like that that

Any help is much appreciated!! Thanks!!

David Arenburg
  • 91,361
  • 17
  • 137
  • 196
Veronica
  • 27
  • 7

1 Answers1

0

You can use the package scales. This should work:

library(scales)

ggplot() +  
geom_bar(data = game_tag, aes(x = tag, fill = status), position="fill") +
coord_flip() +
scale_y_continuous(labels = percent_format())
erc
  • 10,113
  • 11
  • 57
  • 88