当前位置:网站首页>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'}
边栏推荐
- X-ray normal based contour rendering
- Basic MySQL operations
- [free completion] development of course guidance platform (source code +lunwen)
- The longest subarray length with a positive product of 1567 recorded by leecode
- How to choose cross-border e-commerce multi merchant system
- Basic use of continuous integration server Jenkins
- PostgreSQL database high availability Patroni source code learning - etcd class
- Which Bluetooth headset is cost-effective? Four Bluetooth headsets with high cost performance are recommended
- [Chongqing Guangdong education] reference materials for design and a better life of Zhongyuan Institute of science and technology
- Preliminary cognition of C language pointer
猜你喜欢

How to choose cross-border e-commerce multi merchant system

拆一辆十万元的比亚迪“元”,快来看看里面的有哪些元器件。

How to retrieve the password for opening word files

Web - Information Collection

使用BENCHMARKSQL工具对kingbasees并发测试时kill掉主进程成功后存在子线程未及时关闭

Joint set search: merge intervals and ask whether two numbers are in the same set

vulnhub HA: Natraj

arthas watch 抓取入参的某个字段/属性

540. Single element in ordered array

Nat. Comm. | use tensor cell2cell to deconvolute cell communication with environmental awareness
随机推荐
FFMpeg filter
国产PC系统完成闭环,替代美国软硬件体系的时刻已经到来
Causal AI, a new paradigm for industrial upgrading of the next generation of credible AI?
JS realizes the animation effect of text and pictures in the visual area
GFS distributed file system (it's nice to meet it alone)
[fairseq] 报错:TypeError: _broadcast_coalesced(): incompatible function arguments
Deep dive kotlin synergy (20): build flow
[set theory] Cartesian product (concept of Cartesian product | examples of Cartesian product | properties of Cartesian product | non commutativity | non associativity | distribution law | ordered pair
[fxcg] market analysis today
MongoDB 慢查询语句优化分析策略
When using the benchmarksql tool to preheat data for kingbasees, execute: select sys_ Prewarm ('ndx_oorder_2 ') error
Function introduction of member points mall system
Kubernetes source code analysis (I)
智能合约安全审计公司选型分析和审计报告资源下载---国内篇
一名外包仔的2022年中总结
The longest subarray length with a positive product of 1567 recorded by leecode
Data Lake three swordsmen -- comparative analysis of delta, Hudi and iceberg
Classes in TS
Preliminary cognition of C language pointer
MySQL field userid comma separated save by userid query