在饼图上显示百分比值

时间:2016-02-28 12:46:13

标签: r ggplot2 pie-chart

我正在尝试使用ggplot2绘制饼图。我的代码如下所示。

df <- data.frame(
  variable = c("australia","hungary","germany","france","canada"),
  value = c(632,20,491,991,20)
)
ggplot(df, aes(x = "", y = value, fill = variable)) +
  geom_bar(width = 1, stat = "identity") +
  scale_fill_manual(values = c("red", "yellow","blue", "green", "cyan")) +
  coord_polar(theta = "y") +
  labs(title = "pie chart")

我想显示百分比值。我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:6)

尝试

<div style="height:55px;" ng-app="profileDetailsApp" ng-controller="contactController">
            <md-input-container > 
                <label>Email</label>
                <input type="email" name="emailId" ng-model="emailId" > 
             </md-input-container>
    <md-button class="md-raised" ng-click="msg()" >Next</md-button>
    </div>
相关问题