当前位置:网站首页>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'}
边栏推荐
- Interface in TS
- RSRS指标择时及大小盘轮动
- Kubernetes source code analysis (I)
- 2022 beautician (intermediate) new version test questions and beautician (intermediate) certificate examination
- Leecode swipe questions and record LCP 18 breakfast combination
- How to process the current cell with a custom formula in conditional format- How to address the current cell in conditional format custom formula?
- xrandr修改分辨率與刷新率
- Basic syntax of class
- Mongodb slow query optimization analysis strategy
- [set theory] set identities (idempotent law | exchange law | combination law | distribution rate | De Morgan law | absorption rate | zero law | identity | exclusion law | contradiction law | complemen
猜你喜欢

The latest activation free version of Omni toolbox

Two points -leetcode-540 A single element in an ordered array

Busycal latest Chinese version

After reviewing MySQL for a month, I was stunned when the interviewer of Alibaba asked me

FFMpeg filter

redis 持久化原理

X-ray normal based contour rendering

JS realizes the animation effect of text and pictures in the visual area

vulnhub HA: Natraj

vulnhub HA: Natraj
随机推荐
Which Bluetooth headset is cost-effective? Four Bluetooth headsets with high cost performance are recommended
[free completion] development of course guidance platform (source code +lunwen)
Competitive product analysis and writing
Mongodb slow query optimization analysis strategy
Pdf editing tool movavi pdfchef 2022 direct download
Kubernetes源码分析(一)
Golang -- realize file transfer
Analysis of the reason why the server cannot connect remotely
【毕业季·进击的技术er】职场人的自白
Design and implementation of kubelet garbage collection mechanism to protect nodes from being preempted by containers image GC high threshold
Taking two column waterfall flow as an example, how should we build an array of each column
sd卡数据损坏怎么回事,sd卡数据损坏怎么恢复
mysql字段userid逗号分开保存按userid查询
Priv-app permission异常
[NLP]—sparse neural network最新工作简述
Redraw and reflow
FuncS sh file not found when using the benchmarksql tool to test kingbases
MySQL field userid comma separated save by userid query
vulnhub HA: Natraj
FFMpeg filter