当前位置:网站首页>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'}
边栏推荐
- Xrandr modify resolution and refresh rate
- 2022-02-13 (347. Top k high frequency elements)
- 一名外包仔的2022年中总结
- Classes in TS
- vulnhub HA: Natraj
- [set theory] set concept and relationship (set family | set family examples | multiple sets)
- [fxcg] market analysis today
- Reptile exercise 03
- How to connect WiFi with raspberry pie
- Php+mysql registration landing page development complete code
猜你喜欢

Busycal latest Chinese version

【毕业季·进击的技术er】职场人的自白

国产PC系统完成闭环,替代美国软硬件体系的时刻已经到来

X-ray normal based contour rendering
![[文献阅读] Sparsity in Deep Learning: Pruning and growth for efficient inference and training in NN](/img/7e/50fa6f65b5a4f0bb60909f57daff56.png)
[文献阅读] Sparsity in Deep Learning: Pruning and growth for efficient inference and training in NN

Arthas watch grabs a field / attribute of the input parameter

Nat. Comm. | use tensor cell2cell to deconvolute cell communication with environmental awareness

Causal AI, a new paradigm for industrial upgrading of the next generation of credible AI?

js实现在可视区内,文字图片动画效果

After reviewing MySQL for a month, I was stunned when the interviewer of Alibaba asked me
随机推荐
Five elements of user experience
2022-02-12 (338. Bit count)
[software testing-6] & Test Management
FuncS sh file not found when using the benchmarksql tool to test kingbases
xrandr修改分辨率与刷新率
A outsourcing boy's mid-2022 summary
Redraw and reflow
[graduation season · aggressive technology Er] Confessions of workers
Solve BP Chinese garbled code
vulnhub HA: Natraj
SSM based campus part-time platform for College Students
有道云笔记
redis 持久化原理
Leecode swipe questions and record LCP 18 breakfast combination
xrandr修改分辨率與刷新率
Feature_selection
Reptile exercise 02
用户体验五要素
Which Bluetooth headset is good about 400? Four Bluetooth headsets with strong noise reduction are recommended
C language series - Section 3 - functions