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

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

主站蜘蛛池模板: 赤壁市| 铅山县| 甘谷县| 台北县| 鄱阳县| 子长县| 惠州市| 奉化市| 浪卡子县| 宁津县| 德钦县| 朝阳区| 宁安市| 舟曲县| 沅陵县| 九寨沟县| 临洮县| 洛浦县| 平江县| 鄂州市| 于田县| 洛川县| 晴隆县| 祥云县| 万源市| 洱源县| 稻城县| 鹤壁市| 满洲里市| 科技| 普安县| 凤凰县| 进贤县| 宁乡县| 阜阳市| 包头市| 玉树县| 定远县| 梁河县| 泗洪县| 丰都县|