当前位置:网站首页>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
边栏推荐
- ViewRootImpl和WindowManagerService笔记
- How to form standard interface documents
- 序列联配Sequence Alignment
- 培养机器人教育创造力的前沿科技
- 王老吉药业“关爱烈日下最可爱的人”公益活动在南京启动
- 2. < tag hash table, string> supplement: Sword finger offer 50 The first character DBC that appears only once
- 解析创客教育的知识迁移和分享精神
- 解析五育融合之下的steam教育模式
- phpstudy小皮的mysql点击启动后迅速闪退,已解决
- Material Design组件 - 使用BottomSheet展现扩展内容(二)
猜你喜欢

解读协作型机器人的日常应用功能

鸿蒙os第四次学习

Analyze the knowledge transfer and sharing spirit of maker Education

【刷题记录】1. 两数之和
![最长摆动序列[贪心练习]](/img/e1/70dc21b924232c7e5e3da023a4bed2.png)
最长摆动序列[贪心练习]

Abnova丨DNA 标记高质量控制测试方案

When steam education enters personalized information technology courses

王老吉药业“关爱烈日下最可爱的人”公益活动在南京启动

Duchefa d5124 md5a medium Chinese and English instructions

Duchefa p1001 plant agar Chinese and English instructions
随机推荐
Clear app data and get Icon
Norgen AAV extractant box instructions (including features)
手机开户股票开户安全吗?我家比较偏远,有更好的开户途径么?
10000+ 代码库、3000+ 研发人员大型保险集团的研发效能提升实践
14、Transformer--VIT TNT BETR
Monorepo管理方法论和依赖安全
最长摆动序列[贪心练习]
Popular science | does poor English affect the NPDP exam?
Which is the best online collaboration product? Microsoft loop, notion, flowus
科普|英语不好对NPDP考试有影响吗 ?
The development of research tourism practical education helps the development of cultural tourism industry
Abbkine BCA法 蛋白质定量试剂盒说明书
Abnova fluorescent dye 620-m streptavidin scheme
Selenium element information
Nprogress plug-in progress bar
Duchefa MS medium contains vitamin instructions
珍爱网微服务底层框架演进从开源组件封装到自研
Abbkine trakine F-actin Staining Kit (green fluorescence) scheme
Duchefa low melting point agarose PPC Chinese and English instructions
解析创客教育的知识迁移和分享精神