当前位置:网站首页>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()
运行示例:
边栏推荐
- 吴恩达2022机器学习课程评测来了!
- 实现多彩线条摆出心形
- Please help xampp to do sqlilab is a black
- 不要再说微服务可以解决一切问题了
- How does crmeb mall system help marketing?
- mysql连接vscode成功了,但是报这个错
- Why are some people still poor and living at the bottom of society even though they have been working hard?
- (1) Chang'an chain learning notes - start Chang'an chain
- Experiment 4: installing packages from Gui
- Scholar doctor hahaha
猜你喜欢
leetcode:236. The nearest common ancestor of binary tree
氢创未来 产业加速 | 2022氢能专精特新创业大赛报名通道开启!
Isomorphism + cross end, knowing applet +kbone+finclip is enough!
PDF批量拆分、合并、书签提取、书签写入小工具
None of the strongest kings in the monitoring industry!
leetcode:236. 二叉树的最近公共祖先
每年 2000 亿投资进入芯片领域,「中国芯」创投正蓬勃
Use mitmproxy to cache 360 degree panoramic web pages offline
koa2对Json数组增删改查
(shuttle) navigation return interception: willpopscope
随机推荐
MySQL implementation of field segmentation from one line to multiple lines of example code
AI金榜题名时,MLPerf榜单的份量究竟有多重?
The programmer said, "I'm 36 years old, and I don't want to be rolled, let alone cut."
docker mysql5.7如何设置不区分大小写
Station B boss used my world to create convolutional neural network, Lecun forwarding! Burst the liver for 6 months, playing more than one million
spark调优(二):UDF减少JOIN和判断
使用MitmProxy离线缓存360度全景网页
Koa2 addition, deletion, modification and query of JSON array
氢创未来 产业加速 | 2022氢能专精特新创业大赛报名通道开启!
Ajout, suppression et modification d'un tableau json par JS
js對JSON數組的增删改查
求帮助xampp做sqlilab是一片黑
JS addition, deletion, modification and query of JSON array
How to implement Lua entry of API gateway
Gradle知識概括
这个『根据 op 值判断操作类型来自己组装 sql』是指在哪里实现?是指单纯用 Flink Tabl
The method of reinstalling win10 system is as simple as that
MySQL connected vscode successfully, but this error is reported
谁说新消费品牌大溃败?背后有人赢麻了
不要再说微服务可以解决一切问题了