当前位置:网站首页>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()
运行示例:
边栏推荐
- The best sister won the big factory offer of 8 test posts at one go, which made me very proud
- 人均瑞数系列,瑞数 4 代 JS 逆向分析
- How much does the mlperf list weigh when AI is named?
- Isomorphism + cross end, knowing applet +kbone+finclip is enough!
- Experiment 6: installing eve-ng
- Laravel8 uses passport authentication to log in and generate a token
- Flutter life cycle
- Ajout, suppression et modification d'un tableau json par JS
- asp读取oracle数据库问题
- [communication] optimal power allocation in the uplink of two-layer wireless femtocell network with matlab code
猜你喜欢

leetcode:236. 二叉树的最近公共祖先

每年 2000 亿投资进入芯片领域,「中国芯」创投正蓬勃

B站大佬用我的世界搞出卷積神經網絡,LeCun轉發!爆肝6個月,播放破百萬

mysql连接vscode成功了,但是报这个错

I've been laid off, and I'll lose money for everything. The days when I once made a monthly salary of 20000 are not coming back

基础图表解读“东方甄选”爆火出圈数据

Modules that can be used by both the electron main process and the rendering process

B 站弹幕 protobuf 协议还原分析

氢创未来 产业加速 | 2022氢能专精特新创业大赛报名通道开启!

每日刷题记录 (十五)
随机推荐
问下各位,有没有flink sql生成作业的文档啊或是案列啊知道flink cli可以建表和指定目
设计一个抢红包系统
Up to 5million per person per year! Choose people instead of projects, focus on basic scientific research, and scientists dominate the "new cornerstone" funded by Tencent to start the application
Why are some people still poor and living at the bottom of society even though they have been working hard?
今日睡眠质量记录78分
11 preparations for Web3 and Decentralization for traditional enterprises
[unmanned aerial vehicle] multi unmanned cooperative task allocation program platform, including Matlab code
吴恩达2022机器学习课程评测来了!
Please help xampp to do sqlilab is a black
新手问个问题,我现在是单机部署的,提交了一个sql job运行正常,如果我重启了服务job就没了又得
Gold three silver four, don't change jobs
None of the strongest kings in the monitoring industry!
Efficient ETL Testing
每年 2000 亿投资进入芯片领域,「中国芯」创投正蓬勃
Today's sleep quality record 78 points
TDengine 社区问题双周精选 | 第二期
MySQL implementation of field segmentation from one line to multiple lines of example code
flinksql select id ,count(*) from a group by id .
MySQL connected vscode successfully, but this error is reported
Wasserstein Slim GAIN with Gradient Penalty(WSGAIN-GP)介绍及代码实现——基于生成对抗网络的缺失数据填补