当前位置:网站首页>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
边栏推荐
- 欢迎来战,赢取丰厚奖金:Code Golf 代码高尔夫挑战赛正式启动
- Duchefa MS medium contains vitamin instructions
- How to renew NPDP? Here comes the operation guide!
- 产品好不好,谁说了算?Sonar提出分析的性能指标,帮助您轻松判断产品性能及表现
- Analysis of steam education mode under the integration of five Education
- AI automatically generates annotation documents from code
- Duchefa丨D5124 MD5A 培养基中英文说明书
- Abnova丨E (DIII) (WNV) 重组蛋白 中英文说明书
- NPDP如何续证?操作指南来了!
- E. Singhal and numbers (prime factor decomposition)
猜你喜欢
Norgen AAV extractant box instructions (including features)
Analyze the knowledge transfer and sharing spirit of maker Education
leetcode:1755. 最接近目标值的子序列和
Which is the best online collaboration product? Microsoft loop, notion, flowus
Duchefa d5124 md5a medium Chinese and English instructions
XML建模
Abbkine trakine F-actin Staining Kit (green fluorescence) scheme
Duchefa丨S0188盐酸大观霉素五水合物中英文说明书
表单文本框的使用(二) 输入过滤(合成事件)
MySQL InnoDB架构原理
随机推荐
ProSci LAG3抗体的化学性质和应用说明
Abbkine trakine F-actin Staining Kit (green fluorescence) scheme
Duchefa丨MS培养基含维生素说明书
Which is the best online collaboration product? Microsoft loop, notion, flowus
leetcode:1755. 最接近目标值的子序列和
1. Strengthen learning basic knowledge points
NPDP如何续证?操作指南来了!
基于AVFoundation实现视频录制的两种方式
实现浏览页面时校验用户是否已经完成登录的功能
Make Jar, Not War
Applet event binding
Duchefa丨D5124 MD5A 培养基中英文说明书
[Yugong series] go teaching course in July 2022 004 go code Notes
Abnova丨血液总核酸纯化试剂盒预装相关说明书
小程序全局配置
AI automatically generates annotation documents from code
解读协作型机器人的日常应用功能
Pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
Specification of protein quantitative kit for abbkine BCA method
go 文件路径操作