Skip to content

Commit 2603a7e

Browse files
authored
Create multplot.py
一个画布上,按对象形式画多个子图
1 parent 605f5cc commit 2603a7e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

matplotlib/multplot.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#Author: Listen
2+
#!/usr/bin/env python3
3+
#-*- coding:utf-8 -*-
4+
5+
import matplotlib.pyplot as plt
6+
import numpy as np
7+
8+
fig = plt.figure()
9+
ax1 = fig.add_subplot(1,2,1)
10+
x=[1,2,3,4]
11+
y=[2,3,4,5]
12+
ax1.plot(x,y,'o',color='r')
13+
ax1.set_title('Simple figure')
14+
15+
ax2 = fig.add_subplot(1,2,2)
16+
x=[1,2,3,4]
17+
y=[2,3,4,5]
18+
ax2.plot(x,y,'*',color='b')
19+
ax2.set_title('Simple figure')
20+
21+
fig.savefig('../savefig/multplot.png')
22+
23+
plt.show()

0 commit comments

Comments
 (0)