当前位置:网站首页>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
边栏推荐
- Classic implementation of the basic method of intelligent home of Internet of things
- The Chinese Academy of Management Sciences gathered industry experts, and Fu Qiang won the title of "top ten youth" of think tank experts
- Specification of protein quantitative kit for abbkine BCA method
- [UE4] unrealinsight obtains the real machine performance test report
- Duchefa丨S0188盐酸大观霉素五水合物中英文说明书
- Propping of resources
- Abnova丨血液总核酸纯化试剂盒预装相关说明书
- leetcode:1755. 最接近目标值的子序列和
- ts 之 属性的修饰符public、private、protect
- Abnova丨E (DIII) (WNV) 重组蛋白 中英文说明书
猜你喜欢

How to make ERP inventory accounts of chemical enterprises more accurate

Abbkine BCA法 蛋白质定量试剂盒说明书

基于AVFoundation实现视频录制的两种方式

从架构上详解技术(SLB,Redis,Mysql,Kafka,Clickhouse)的各类热点问题
mysql全面解析json/数组

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

MySQL InnoDB架构原理

National Eye Care Education Conference, 2022 the Fourth Beijing International Youth eye health industry exhibition

The development of research tourism practical education helps the development of cultural tourism industry

Maker education infiltrating the transformation of maker spirit and culture
随机推荐
Abnova丨荧光染料 620-M 链霉亲和素方案
教你自己训练的pytorch模型转caffe(一)
How to renew NPDP? Here comes the operation guide!
Binary search
How to open an account online for futures? Is it safe?
基于AVFoundation实现视频录制的两种方式
Redis唯一ID生成器的实现
Classic implementation method of Hongmeng system controlling LED
Make Jar, Not War
Abnova丨血液总核酸纯化试剂盒预装相关说明书
Clear app data and get Icon
MYSQL IFNULL使用功能
重上吹麻滩——段芝堂创始人翟立冬游记
MySQL fully parses json/ arrays
Abnova丨培养细胞总 RNA 纯化试剂盒中英文说明书
Chemical properties and application instructions of prosci Lag3 antibody
Prosci LAG-3 recombinant protein specification
[record of question brushing] 1 Sum of two numbers
Research and development efficiency improvement practice of large insurance groups with 10000 + code base and 3000 + R & D personnel
Duchefa d5124 md5a medium Chinese and English instructions