Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b3c21d3

Browse filesBrowse files
committed
DOC: tweak demo a bit
- use plt.subplots - adjust correct spacing
1 parent f649739 commit b3c21d3
Copy full SHA for b3c21d3

File tree

Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed

‎examples/pylab_examples/csd_demo.py

Copy file name to clipboardExpand all lines: examples/pylab_examples/csd_demo.py
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
import numpy as np
66
import matplotlib.pyplot as plt
77

8+
9+
fig, (ax1, ax2) = plt.subplots(2, 1)
810
# make a little extra space between the subplots
9-
plt.subplots_adjust(wspace=0.5)
11+
fig.subplots_adjust(hspace=0.5)
1012

1113
dt = 0.01
1214
t = np.arange(0, 30, dt)
@@ -21,14 +23,12 @@
2123
s1 = 0.01*np.sin(2*np.pi*10*t) + cnse1
2224
s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2
2325

24-
plt.subplot(211)
25-
plt.plot(t, s1, t, s2)
26-
plt.xlim(0, 5)
27-
plt.xlabel('time')
28-
plt.ylabel('s1 and s2')
29-
plt.grid(True)
26+
ax1.plot(t, s1, t, s2)
27+
ax1.set_xlim(0, 5)
28+
ax1.set_xlabel('time')
29+
ax1.set_ylabel('s1 and s2')
30+
ax1.grid(True)
3031

31-
plt.subplot(212)
32-
cxy, f = plt.csd(s1, s2, 256, 1./dt)
33-
plt.ylabel('CSD (db)')
32+
cxy, f = ax2.csd(s1, s2, 256, 1./dt)
33+
ax2.set_ylabel('CSD (db)')
3434
plt.show()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.