当前位置:网站首页>Visual common drawing (IV) histogram
Visual common drawing (IV) histogram
2022-04-23 10:54:00 【The big pig of the little pig family】
Visualizing common drawings ( Four ) Histogram
One . Introduction to histogram
Basic histogram , Use vertical or horizontal columns to show numerical comparisons between categories . One axis represents the classification dimension to be compared , The other axis represents the corresponding value .
A histogram is different from a histogram , The histogram can't show the continuous change trend of data in an interval . The histogram describes the classified data , The answer is in each category 【 How many? ?】 This problem . It should be noted that , When the histogram shows a lot of categories, it will lead to display problems such as cascade of category names .
Two . The composition of the histogram
The bar chart includes at least the following parts :
- Horizontal axis category
- Number of longitudinal axes / The number
- graphics
- legend
3、 ... and . Use scenarios
Data used : A category field , A numeric field .
The main function : Compare the numerical size of classified data .
Number of data : No more than 30 Data .
Applicable scenario :
- It is suitable for classification data comparison .
Not applicable to the scene :
- When there are too many data categories .
- When you want to show data trends .
Four . Realization
stay matplotlib Use in bar
Function to draw a histogram , For a detailed introduction of the function and the annotation of the histogram, see the links below .
notes :
Take the following table as an example to draw the histogram
genre( The game type ) | sold( Sales volume ) |
---|---|
Sports | 27,500 |
Strategy | 11,500 |
Action | 6,000 |
Shooter | 3,500 |
Other | 1,500 |
The complete program code is as follows :
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei'] # Settings support Chinese
plt.rcParams['axes.unicode_minus'] = False # Set up - Number
plt.style.use('ggplot')
genre = ["Sports", "Strategy", "Action", "Shooter", "Other"]
sold = [27500, 11500, 6000, 3500, 1500]
patches = plt.bar(range(len(sold)), sold, width=0.5, color=['red', 'green', 'blue', "cyan", "olive"])
plt.bar_label(patches)
plt.xticks(range(len(sold)), genre, fontsize=15)
plt.xlabel(" Types of games ", fontsize=20)
plt.ylabel(" sales ( individual )", fontsize=20)
plt.title("2021 Comparison of annual game sales ", fontsize=25, fontweight="bold")
plt.grid()
plt.legend(patches, genre, fontsize=15)
plt.show()
The results are as follows :
5、 ... and . Reference resources
版权声明
本文为[The big pig of the little pig family]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230617063326.html
边栏推荐
- 关于JUC三大常用辅助类
- Is the pointer symbol of C language close to variable type or variable name?
- 得到知识服务app原型设计比较与实践
- Hikvision face to face summary
- Full stack cross compilation x86 completion process experience sharing
- 209. Subarray with the smallest length (array)
- JVM - common parameters
- Latex usage
- MySQL common statements
- Pytorch implementation of transformer
猜你喜欢
Diary of dishes | Blue Bridge Cup - hexadecimal to octal (hand torn version) with hexadecimal conversion notes
Source insight 4.0 FAQs
Learning Notes 6 - Summary of several deep learning convolutional neural networks
Yarn resource scheduler
Solution architect's small bag - 5 types of architecture diagrams
Learning note 5 - gradient explosion and gradient disappearance (k-fold cross verification)
Swagger2 自定义参数注解如何不显示
Yarn core parameter configuration
mysql同一个表中相同数据怎么合并
Windows installs redis and sets the redis service to start automatically
随机推荐
[provincial election joint examination 2022 d2t1] card (state compression DP, FWT convolution)
解决方案架构师的小锦囊 - 架构图的 5 种类型
997. Square of ordered array (array)
任意文件读取漏洞 利用指南
Notes on concurrent programming of vegetables (IX) asynchronous IO to realize concurrent crawler acceleration
Image processing - Noise notes
997、有序数组的平方(数组)
Read integrity monitoring techniques for vision navigation systems
Swagger2 接口如何导入Postman
Let the LAN group use the remote device
Xdotool key Wizard
209. Subarray with the smallest length (array)
UEditor之——图片上传组件大小4M的限制
[Niuke challenge 47] C. conditions (BitSet acceleration Floyd)
比深度学习更值得信赖的模型ART
定义链表(链表)
What about Jerry's stack overflow? [chapter]
Hikvision face to face summary
206. Reverse linked list (linked list)
Dirichlet prefix sum (number theory optimization formula sub complexity weapon)