当前位置:网站首页>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'}
边栏推荐
- 2022-02-14 (394. String decoding)
- 金仓数据库KingbaseES 插件kdb_date_function
- Interface in TS
- [fairseq] 报错:TypeError: _broadcast_coalesced(): incompatible function arguments
- Joint search set: the number of points in connected blocks (the number of points in a set)
- [set theory] set operation (Union | intersection | disjoint | relative complement | symmetric difference | absolute complement | generalized union | generalized intersection | set operation priority)
- When using the benchmarksql tool to preheat data for kingbasees, execute: select sys_ Prewarm ('ndx_oorder_2 ') error
- 使用BENCHMARKSQL工具对KingbaseES执行测试时报错funcs sh file not found
- Joint set search: merge intervals and ask whether two numbers are in the same set
- Reptile exercise 03
猜你喜欢

Five elements of user experience

使用BENCHMARKSQL工具对kingbaseES执行灌数据提示无法找到JDBC driver

Which Bluetooth headset is good about 400? Four Bluetooth headsets with strong noise reduction are recommended

Library management system based on SSM

Deep dive kotlin synergy (19): flow overview

Introduction of pointer variables in function parameters

金仓KFS数据双向同步场景部署

Bugku CTF daily question baby_ flag. txt

Design and implementation of JSP logistics center storage information management system

How to retrieve the password for opening word files
随机推荐
使用BENCHMARKSQL工具对kingbaseES执行灌数据提示无法找到JDBC driver
[fxcg] market analysis today
Xrandr modify resolution and refresh rate
C language series - Section 3 - functions
Mongodb slow query optimization analysis strategy
金仓KFS数据双向同步场景部署
[Thesis Writing] how to write the overall design of JSP tourism network
JS实现图片懒加载
Export of zip file
Smart contract security audit company selection analysis and audit report resources download - domestic article
JS realizes lazy loading of pictures
Supervised pre training! Another exploration of text generation!
使用BENCHMARKSQL工具对KingbaseES预热数据时执行:select sys_prewarm(‘NDX_OORDER_2 ‘)报错
Why should programmers learn microservice architecture if they want to enter a large factory?
Golang -- realize file transfer
Basic types of data in TS
[NLP]—sparse neural network最新工作简述
[free completion] development of course guidance platform (source code +lunwen)
商城系统搭建完成后需要设置哪些功能
MySQL field userid comma separated save by userid query