当前位置:网站首页>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
边栏推荐
- Duchefa丨低熔点琼脂糖 PPC中英文说明书
- 证券开户选择哪个证券比较好?网上开户安全么?
- ProSci LAG-3 重组蛋白说明书
- AI automatically generates annotation documents from code
- Return to blowing marshland -- travel notes of zhailidong, founder of duanzhitang
- Abnova DNA marker high quality control test program
- LeetCode: Distinct Subsequences [115]
- Is the securities account given by the school of Finance and business safe? Can I open an account?
- Wanglaoji pharmaceutical's public welfare activity of "caring for the most lovely people under the scorching sun" was launched in Nanjing
- Pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
猜你喜欢

2022 Beijing eye health products exhibition, eye care products exhibition, China eye Expo held in November

Return to blowing marshland -- travel notes of zhailidong, founder of duanzhitang

Abnova丨CRISPR SpCas9 多克隆抗体方案

教你自己训练的pytorch模型转caffe(二)

解析创客教育的知识迁移和分享精神

phpstudy小皮的mysql点击启动后迅速闪退,已解决

Specification of protein quantitative kit for abbkine BCA method

Duchefa cytokinin dihydrozeatin (DHZ) instructions

Abnova丨荧光染料 620-M 链霉亲和素方案

leetcode:1755. 最接近目标值的子序列和
随机推荐
Is it safe to open a stock account by mobile phone? My home is relatively remote. Is there a better way to open an account?
National Eye Care Education Conference, 2022 the Fourth Beijing International Youth eye health industry exhibition
leetcode:1755. 最接近目标值的子序列和
Is the securities account given by the school of Finance and business safe? Can I open an account?
Abbkine BCA法 蛋白质定量试剂盒说明书
Welcome to the game and win rich bonuses: Code Golf Challenge officially launched
王老吉药业“关爱烈日下最可爱的人”公益活动在南京启动
教你自己训练的pytorch模型转caffe(二)
珍爱网微服务底层框架演进从开源组件封装到自研
Abnova maxpab mouse derived polyclonal antibody solution
Norgen AAV extractant box instructions (including features)
小程序代码的构成
Abnova cyclosporin a monoclonal antibody and its research tools
中国管理科学研究院凝聚行业专家,傅强荣获智库专家“十佳青年”称号
PHP反序列化+MD5碰撞
Abnova 环孢素A单克隆抗体,及其研究工具
鸿蒙os第四次学习
国外LEAD美国简称对照表
Selenium element information
Use of form text box (II) input filtering (synthetic event)