当前位置:网站首页>Matplotlib drawing tips
Matplotlib drawing tips
2022-06-21 12:46:00 【Mark_ Aussie】
Automatically close after displaying the graph :
Use plt.show() If it is not closed manually, the program will get stuck ;
Problems encountered in practice : Use plt.show() After that, you can display the required diagram , If it is not used, it will not display correctly , But it needs to produce a large number of drawings , It can't be turned off manually , Instead of plt.show()
plt.pause(0.01) # Show seconds plt.close()
Automatic shutdown through multithreading fig Methods ( Fail to succeed )
Set line type :
Use plt.plot() Draw a straight line , You can use linestyle Set line type ;“:” Said the dotted line ( green ),“--” It's the dotted line ( blue )

Custom properties :color( Color )marker( The shape of the marker )linestyle( Line shape )linewidth( Line width )marksize( The size of the mark )label( label , For legend )
marker:S --> A solid square P --> Solid Pentagram O --> Solid round * --> Stars D --> The diamond
linestyle:- Solid line : Dotted line – Broken line -. Draw a dotted line
figure:
Create a global drawing area ,facecolor=None Is a colorless background
plt.figure(figsize=None, facecolor=None) # figsize(a,b) Parameters in a Is the width of the plot area ,b Is the height

Display Chinese and font settings :

Mark the median size of the drawing :
plt.text(a,b,b) # data display x Corresponding position of shaft 、 The height of the displayed position ( You can adjust )、 The size of the displayed data value
for a, b in zip(x, highest): # Use for The loop outputs in turn zip() Corresponding connection
plt.text(a, b + 2, b, ha=‘center’, va=‘bottom’)

Reference resources :
https://www.csdn.net/tags/NtjaYgwsMTY2OTUtYmxvZwO0O0OO0O0O.html
边栏推荐
猜你喜欢

TOOD: Task-aligned One-stage Object Detection

TOOD: Task-aligned One-stage Object Detection

Educoder Web练习题---分组元素

matplotlib 画图 Tips

Educoder Web练习题---页面结点元素

3D Slicer将分割结果保存

Educator web exercise - grouping form elements

Three structures of program - system learning I

Educoder web exercises -- text level semantic elements

DVWA configuration tutorial
随机推荐
UVA1203 Argus
Educoder Web练习题---对表单元素分组
Educoder web exercises - structural elements
Deep learning practice (10): 3D medical image segmentation using pytorch
Methods commonly used in uniapp (part) - timestamp problem and rich text parsing image problem
2022年CIO需要关注的九个趋势和优先事项
Generalized Focal Loss: Learning Qualified and Distributed Bounding Boxes for Dense Object Detection
Educoder Web练习题---分组元素
3. 函数提高
typescript localStorage 封装
深度学习实战(十):使用 PyTorch 进行 3D 医学图像分割
Educator table labels - settings for Advanced Table Styles
愿山河无恙
Libcef common concepts framework features
How to delete floating IP manually
【Appium踩坑】关闭inspector后打开weditor,uiautomator2.exceptions.NullPointerExceptionError: -32001 Jsonrpc er
Version of opengauss
配电室环境监控系统技术方案
Practical application of ankerui BM100 series signal isolator
卷积神经网络“卷积”的深层理解