当前位置:网站首页>matplotlib画柱状图并添加数值到图中
matplotlib画柱状图并添加数值到图中
2022-07-06 15:59:00 【L-M-Y】
matplotlib画图细节可参考前文:
https://blog.csdn.net/qq_52109814/article/details/121901438?spm=1001.2014.3001.5501
from matplotlib import pyplot as plt
import numpy as np
#编辑图例
def autolabel(rects):
for rect in rects:
height = rect.get_height()
#设置图例字体、位置、数值等等
plt.text(rect.get_x(), 1.01*height, '%s' %
float(height), size=11, family="Times new roman")
y = ['A', 'B', 'C', 'D', 'E', 'F']
x = [6.624, 7.394, 14.972, 17.545, 21.239, 16.736]
rect = plt.bar(y, x, width=0.5)
autolabel(rect)
plt.title("Overall Value S")
plt.xlabel("Area")
plt.ylabel("Variance")
plt.legend()
plt.show()
运行示例:
边栏推荐
- Gpt-3 is a peer review online when it has been submitted for its own research
- B 站弹幕 protobuf 协议还原分析
- 每日刷题记录 (十五)
- Scholar doctor hahaha
- AcWing 4300. Two operations (minimum number of BFS searches)
- Graphite document: four countermeasures to solve the problem of enterprise document information security
- Modules that can be used by both the electron main process and the rendering process
- (flutter2) as import old project error: inheritfromwidgetofexacttype
- Coscon'22 community convening order is coming! Open the world, invite all communities to embrace open source and open a new world~
- (1) Chang'an chain learning notes - start Chang'an chain
猜你喜欢
若依请求url中带有jsessionid的解决办法
11 preparations for Web3 and Decentralization for traditional enterprises
Stop saying that microservices can solve all problems
传统企业要为 Web3 和去中心化做的 11 个准备
The important data in the computer was accidentally deleted by mistake, which can be quickly retrieved by this method
B站大佬用我的世界搞出卷積神經網絡,LeCun轉發!爆肝6個月,播放破百萬
今日睡眠质量记录78分
Knowledge * review
B 站弹幕 protobuf 协议还原分析
The worse the AI performance, the higher the bonus? Doctor of New York University offered a reward for the task of making the big model perform poorly
随机推荐
Docker mysql5.7 how to set case insensitive
Where does this "judge the operation type according to the op value and assemble SQL by yourself" mean? It means simply using Flink tab
Coscon'22 community convening order is coming! Open the world, invite all communities to embrace open source and open a new world~
js导入excel&导出excel
Wasserstein Slim GAIN with Gradient Penalty(WSGAIN-GP)介绍及代码实现——基于生成对抗网络的缺失数据填补
None of the strongest kings in the monitoring industry!
食品里的添加剂品种越多,越不安全吗?
B 站弹幕 protobuf 协议还原分析
[system analyst's road] Chapter 7 double disk system design (service-oriented development method)
AcWing 4299. Delete point
【系统分析师之路】第七章 复盘系统设计(面向服务开发方法)
The worse the AI performance, the higher the bonus? Doctor of New York University offered a reward for the task of making the big model perform poorly
Devsecops software R & D security practice - release
Today, I met a senior test developer from Tencent and saw the ceiling of the foundation
Example code of MySQL split string as query condition
Can async i/o be implemented by UDF operator and then called by SQL API? At present, it seems that only datastre can be seen
How much does the mlperf list weigh when AI is named?
短链的设计
设计一个抢红包系统
Gpt-3 is a peer review online when it has been submitted for its own research