当前位置:网站首页>matplotlib 画图 Tips
matplotlib 画图 Tips
2022-06-21 12:24:00 【Mark_Aussie】
显示图形后自动关闭:
使用 plt.show() 如果不手动关闭则程序会卡住;
实际中遇到过的问题:使用plt.show()后可以显示需要的图,如不使用则无法正确显示,但需要生产大量的图,不能手动关闭,可使用如下方法替代 plt.show()
plt.pause(0.01) # 显示秒数 plt.close()
通过多线程的方式自动关闭fig的方法(未能成功)
matplotlib画图时调用多线程关闭图形显示_晓东邪的博客-CSDN博客_matplotlib画完图后关闭
设置线条类型:
使用 plt.plot() 画直线图,可使用 linestyle 设置线条类型;“:”表示点线(绿),“--”代表虚线(蓝)

自定义属性:color(颜色)marker(标记的形状)linestyle(线条形状)linewidth(线条宽度)marksize(标记的大小)label(标签,用于图例)
marker:S --> 实心正方形 P --> 实心五角星 O --> 实心圆 * --> 星形 D --> 菱形
linestyle:- 实线 : 虚线 – 破折线 -. 画点线
figure:
创建一个全局绘图区域,facecolor=None 为无色背景
plt.figure(figsize=None, facecolor=None) # figsize(a,b)中的参数a是指绘图区宽度,b则是高度

显示中文及字体设置:

标注图中值大小:
plt.text(a,b,b) # 数据显示x轴对应位置、显示的位置高度(可以调整)、显示的数据值的大小
for a, b in zip(x, highest): # 使用for 循环依次次输出 zip()对应连接
plt.text(a, b + 2, b, ha=‘center’, va=‘bottom’)

参考:
https://www.csdn.net/tags/NtjaYgwsMTY2OTUtYmxvZwO0O0OO0O0O.html
python条形图和线形图的绘制,并显示数据_键盘敲烂工资过万的博客-CSDN博客_python条形图怎么显示数据
边栏推荐
- Standing at the digital tuyere, how can tooling enterprises "fly"
- 【毕业季·进击的技术er】大学生涯的成长之路
- Nanjing University static program analyses -- intermediate representation learning notes
- Educoder Web练习题---文本层次语义元素
- Why are there only 13 root domain name servers in the world
- 『忘了再学』Shell流程控制 — 36、for循环介绍
- Router telnet and ACL configuration
- 2022年CIO需要关注的九个趋势和优先事项
- PingCAP 入选 2022 Gartner 云数据库“客户之声”,获评“卓越表现者”最高分
- i.MX - RT1052 SDCard操作(SDIO接口)
猜你喜欢

i. MX - rt1052 pulse width modulation (PWM)

一文掌握SQLite3基本用法

【无标题】

i. MX - rt1052 boot start

12 tips for achieving it agility in the digital age

Router telnet and ACL configuration

Nanjing University static program analyses -- Introduction learning notes

i. MX - rt1052 SPI and I2C interfaces

Educoder Web练习题---对表单元素分组

Educoder Web练习题---创建下拉列表
随机推荐
~~~~Configuration
[100 unity practical skills] | obtain the coordinates of mouse clicks in the game and move the game object to the click position of the mouse
phpstudy2018安装及打开目录浏览
EasyUI-input取/赋值
SDCC编译器 + VSCode开发 8位微控制器
The difference between knowing and understanding
STM32笔记之 PWM(脉宽调制)
在数字时代实现IT敏捷性的12个技巧
Summary of UART problems in stm32cubemx
智能辅助系统在配电室内的施工方案 安装位置
最新远程部署运维工具汇总
Router telnet and ACL configuration
【毕业季·进击的技术er】大学生涯的成长之路
i. MX - rt1052 clock and phase locked loop (PLL) analysis
8 种最坑的SQL错误用法
Introduction to CPU, MPU, MCU, SOC and MCM
青龙面板XDD-PLUS登录提示“当前登录环境异常,为保障您的账号安全,暂时无法登录。建议将两个设备连接同一网络或WIFI后重新扫码”解决方法。
STM32開發之 VS Code + gcc環境編譯
关于SDRAM存储器
CPU、MPU、MCU、SoC、MCM介绍