2015-10-22 168 views
0

我有以下數據格式百分之堆積柱形圖GGPLOT2

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 

CSV文件我獲得下列方式

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

我想製作一個堆疊%的條形圖的信息。 然而,我只能走這麼遠:

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

The Bar chart I get 我怎樣才能使百分比Y上,而不是數量。 我想要的結果看類似的東西

Like that that

任何幫助深表感謝!謝謝!!

回答

0

您可以使用包scales。這應該工作:

library(scales) 

ggplot() + 
geom_bar(data = game_tag, aes(x = tag, fill = status), position="fill") + 
coord_flip() + 
scale_y_continuous(labels = percent_format()) 
+0

謝謝!現在,這工作正常。 – Veronica