FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
tutorials/matplotlibTUT/plt15_subplot.py at master · MorvanZhou/tutorials · GitHub
MorvanZhou
/
tutorials
Public
Notifications
You must be signed in to change notification settings
Fork
5.7k
Star
13k
Code
Issues
15
Pull requests
2
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
tutorials
/
matplotlibTUT
/
plt15_subplot.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
56 lines (42 loc) · 1.28 KB
Breadcrumbs
tutorials
/
matplotlibTUT
/
plt15_subplot.py
Copy path
File metadata and controls
56 lines (42 loc) · 1.28 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# View more python tutorials on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
# 15 - subplot
"""
Please note, this script is for python3+.
If you are using python2+, please modify it accordingly.
Tutorial reference:
http://www.scipy-lectures.org/intro/matplotlib/matplotlib.html
"""
import
matplotlib
.
pyplot
as
plt
# example 1:
###############################
plt
.
figure
(
figsize
=
(
6
,
4
))
# plt.subplot(n_rows, n_cols, plot_num)
plt
.
subplot
(
2
,
2
,
1
)
plt
.
plot
([
0
,
1
], [
0
,
1
])
plt
.
subplot
(
222
)
plt
.
plot
([
0
,
1
], [
0
,
2
])
plt
.
subplot
(
223
)
plt
.
plot
([
0
,
1
], [
0
,
3
])
plt
.
subplot
(
224
)
plt
.
plot
([
0
,
1
], [
0
,
4
])
plt
.
tight_layout
()
# example 2:
###############################
plt
.
figure
(
figsize
=
(
6
,
4
))
# plt.subplot(n_rows, n_cols, plot_num)
plt
.
subplot
(
2
,
1
,
1
)
# figure splits into 2 rows, 1 col, plot to the 1st sub-fig
plt
.
plot
([
0
,
1
], [
0
,
1
])
plt
.
subplot
(
234
)
# figure splits into 2 rows, 3 col, plot to the 4th sub-fig
plt
.
plot
([
0
,
1
], [
0
,
2
])
plt
.
subplot
(
235
)
# figure splits into 2 rows, 3 col, plot to the 5th sub-fig
plt
.
plot
([
0
,
1
], [
0
,
3
])
plt
.
subplot
(
236
)
# figure splits into 2 rows, 3 col, plot to the 6th sub-fig
plt
.
plot
([
0
,
1
], [
0
,
4
])
plt
.
tight_layout
()
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL