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

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

主站蜘蛛池模板: 固阳县| 犍为县| 伊宁市| 广宗县| 罗江县| 镇沅| 德庆县| 滦南县| 宁陵县| 祥云县| 子洲县| 托克逊县| 桂东县| 广安市| 仪陇县| 鹤山市| 乳山市| 清丰县| 安化县| 万年县| 阳信县| 正镶白旗| 大洼县| 曲阳县| 中西区| 东莞市| 淄博市| 凉城县| 东明县| 维西| 区。| 彰化县| 新乡县| 晋州市| 澄江县| 克东县| 大方县| 江都市| 桃园市| 吉林省| 吉水县|