当前位置:网站首页>Matplotlib -- save graph
Matplotlib -- save graph
2022-07-03 04:25:00 【You can sleep at this stage】
Matplotlib Support various systems and graphic formats . Besides ,Matplotlib The code to save all graphic formats is the same , You only need to call the savefig()
Method , It's very easy to use .
# The import module / package
import matplotlib.pyplot as plt
import numpy as np
# Generate the data
x = np.linspace(0,10,200)
print(x)
fig = plt.figure()# Generate a blank figure and assign it to fig object
# Drawing graphics
plt.plot(x,np.sin(x),'-')
plt.plot(x,np.cos(x),'--')
# The graphics
plt.show()
# Save graphics
fig.savefig("first.png")
fig.savefig("first.pdf")
Use the following statement to view Matplotlib Supported graphic formats .
print(fig.canvas.get_supported_filetypes())
The output format has been adjusted for ease of viewing
{
'ps': 'Postscript',
'eps': 'Encapsulated Postscript',
'pdf': 'Portable Document Format',
'pgf': 'PGF code for LaTeX',
'png': 'Portable Network Graphics',
'raw': 'Raw RGBA bitmap',
'rgba': 'Raw RGBA bitmap',
'svg': 'Scalable Vector Graphics',
'svgz': 'Scalable Vector Graphics',
'jpg': 'Joint Photographic Experts Group',
'jpeg': 'Joint Photographic Experts Group',
'tif': 'Tagged Image File Format',
'tiff': 'Tagged Image File Format'}
边栏推荐
- 金仓KFS数据双向同步场景部署
- Leecode swipe questions and record LCP 18 breakfast combination
- IPhone x forgot the boot password
- Dive into deep learning - 2.1 data operation & Exercise
- RSRS index timing and large and small disc rotation
- BMZCTF simple_ pop
- [mathematical logic] predicate logic (toe normal form | toe normal form conversion method | basic equivalence of predicate logic | name changing rules | predicate logic reasoning law)
- Joint set search: merge intervals and ask whether two numbers are in the same set
- Kingbasees plug-in KDB of Jincang database_ database_ link
- Basic types of data in TS
猜你喜欢
Busycal latest Chinese version
P35-P41 fourth_ context
Feature_selection
Web - Information Collection
CVPR 2022 | Dalian Institute of technology proposes a self calibration lighting framework for low light level image enhancement of real scenes
【毕业季·进击的技术er】职场人的自白
国产PC系统完成闭环,替代美国软硬件体系的时刻已经到来
Use the benchmarksql tool to perform a data prompt on kingbases. The jdbc driver cannot be found
GFS分布式文件系统(光是遇见已经很美好了)
js实现在可视区内,文字图片动画效果
随机推荐
FFMpeg example
[set theory] set concept and relationship (set represents | number set | set relationship | contains | equality | set relationship property)
Busycal latest Chinese version
What functions need to be set after the mall system is built
Competitive product analysis and writing
[NLP]—sparse neural network最新工作简述
Deep dive kotlin synergy (19): flow overview
Human resource management system based on JSP
Js/ts bottom implementation double click event
[set theory] set concept and relationship (set family | set family examples | multiple sets)
vulnhub HA: Natraj
[Chongqing Guangdong education] reference materials for design and a better life of Zhongyuan Institute of science and technology
用户体验五要素
Dive Into Deep Learning——2.1数据操作&&练习
vulnhub HA: Natraj
[no title] 2022 chlorination process examination content and free chlorination process examination questions
arthas watch 抓取入参的某个字段/属性
Ffmpeg mix
GFS distributed file system (it's nice to meet it alone)
Interface in TS