当前位置:网站首页>Matplotlib drawing retouching (how to form high-quality drawings, such as how to set fonts, etc.)
Matplotlib drawing retouching (how to form high-quality drawings, such as how to set fonts, etc.)
2022-07-05 20:49:00 【Interval】
List of articles
Preface
Originally , If you just draw pictures by yourself and steal them by yourself , Generally, there is no such demand , Just default .
However , If you want to print and publish this picture , Or put it in the paper , Or put it in PPT Show in . You'll find that , The default graph is not very good . For example, in the paper , By default , The font inside will be particularly blurred .
import matplotlib.pyplot as plt
The resolution of the
Add the following sentence at the beginning , It can make your picture not blurred .
plt.figure(dpi=300)
style
The style includes many conveniences , font size , Font format, etc .
1. Let's start with a global change , That is to say, add , Then it is globally valid , Very convenient .
plt.rcParams["font.weight"] = "bold"
plt.rcParams["axes.labelweight"] = "bold"
2. Then change it locally .
# Modify the title and x,y Axis font and size
plt.title("$MFCC_0$ Parameter median filter ", fontsize=15,fontweight='bold')
plt.xlabel(" Time /s", fontsize=15,fontweight='bold')
plt.ylabel(" The number ", fontsize=15,fontweight='bold')
# Modify the axis font and size
plt.yticks(fontproperties='Times New Roman', size=15,weight='bold')# Set size and bold
plt.xticks(fontproperties='Times New Roman', size=15)
# Set title
plt.rcParams['font.sans-serif'] = ['KaiTi'] # Used to display Chinese labels normally , If you want to use the New Roman font , Change to Times New Roman
plt.rcParams['axes.unicode_minus'] = False # Used to display negative sign normally
plt.tight_layout() # Solve the overlapping of upper and lower titles when drawing
# Draw line
plt.vlines(starts2time, min(Mfcc1)-10, max(Mfcc1)+10, colors="black", linestyles="solid",lw=2)
plt.vlines(ends2time, min(Mfcc1)-10, max(Mfcc1)+10, colors="black", linestyles="dashed",lw=2.5)
# Add legend
plt.legend(['train acc','train loss'])# Add legend
plt.legend(['train acc','train loss'],fontsize=12)# And set the size
# Cancel the axis scale
plt.xticks([]) # Go to x Coordinate scale
plt.yticks([]) # Go to y Coordinate scale
plt.axis('off') # Go to the axis
# Cancel savefig White border when saving pictures
plt.savefig(pic_name,bbox_inches='tight',pad_inches=0.0)
# Cancel the border of each
ax1 = plt.subplot(2, 3, 1)
ax1.spines['right'].set_visible(False) # On the right
ax1.spines['top'].set_visible(False) # above
ax1.spines['left'].set_visible(False) # On the left
ax1.spines['bottom'].set_visible(False) # Underside
Reference resources
边栏推荐
- Specification of protein quantitative kit for abbkine BCA method
- 欢迎来战,赢取丰厚奖金:Code Golf 代码高尔夫挑战赛正式启动
- haas506 2.0开发教程 - 阿里云ota - pac 固件升级(仅支持2.2以上版本)
- Mathematical analysis_ Notes_ Chapter 9: curve integral and surface integral
- Point cloud file Dat file read save
- Cutting edge technology for cultivating robot education creativity
- ViewRootImpl和WindowManagerService笔记
- 3.3 project evaluation
- CVPR 2022 | common 3D damage and data enhancement
- 渗透创客精神文化转化的创客教育
猜你喜欢
Applet global configuration
Abnova total RNA Purification Kit for cultured cells Chinese and English instructions
Abnova丨E (DIII) (WNV) 重组蛋白 中英文说明书
Frequent MySQL operations cause table locking problems
Duchefa s0188 Chinese and English instructions of spectinomycin hydrochloride pentahydrate
Duchefa low melting point agarose PPC Chinese and English instructions
Duchefa细胞分裂素丨二氢玉米素 (DHZ)说明书
[quick start of Digital IC Verification] 2. Through an example of SOC project, understand the architecture of SOC and explore the design process of digital system
PHP反序列化+MD5碰撞
Which is the best online collaboration product? Microsoft loop, notion, flowus
随机推荐
中国的软件公司为什么做不出产品?00后抛弃互联网;B站开源的高性能API网关组件|码农周刊VIP会员专属邮件周报 Vol.097
重上吹麻滩——段芝堂创始人翟立冬游记
[UE4] unrealinsight obtains the real machine performance test report
Codeforces Round #804 (Div. 2) - A, B, C
Duchefa丨低熔点琼脂糖 PPC中英文说明书
【刷题记录】1. 两数之和
Graph embedding learning notes
2.8 basic knowledge of project management process
Applet global configuration
LeetCode: Distinct Subsequences [115]
[Yugong series] go teaching course in July 2022 004 go code Notes
XML建模
Duchefa丨D5124 MD5A 培养基中英文说明书
Cutting edge technology for cultivating robot education creativity
Abnova丨DNA 标记高质量控制测试方案
Implementation of redis unique ID generator
ts 之 泛型
Abnova CD81 monoclonal antibody related parameters and Applications
Duchefa s0188 Chinese and English instructions of spectinomycin hydrochloride pentahydrate
go 文件路径操作