官术网_书友最值得收藏!

Histogram

A histogram is a visualization consisting of rectangles whose area is proportional to the frequency of a variable and whose width is equal to the class interval.

The height of the bar in a histogram represents the number of observations in each group. In the following example, we are counting the number of observations for each type of job and marital status. y is a binary variable checking whether the client subscribed a term deposit or not (yes, no) as a response to the campaign call.

It looks like blue-collar individuals are responding to the campaign calls the least, and individuals in management jobs are subscribing to the term deposit the most:

ggplot(data = df_bank_detail) +

geom_bar(mapping = aes(x=job, fill = y)) +

theme(axis.text.x = element_text(angle=90, vjust=.8, hjust=0.8))

Figure 1.11: Histogram of count and job

主站蜘蛛池模板: 黎城县| 前郭尔| 大庆市| 比如县| 新蔡县| 丰县| 定结县| 浙江省| 紫阳县| 荥阳市| 离岛区| 永顺县| 吉木乃县| 蕲春县| 托克逊县| 新蔡县| 临邑县| 昌吉市| 南乐县| 南岸区| 红河县| 白河县| 文昌市| 富宁县| 安化县| 兰考县| 丽水市| 文成县| 闽清县| 根河市| 原平市| 微山县| 黔东| 吉首市| 怀远县| 泰顺县| 堆龙德庆县| 娄烦县| 临漳县| 卓尼县| 太康县|