Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1e58203 commit a664c8aCopy full SHA for a664c8a
1 file changed
examples/subplots_axes_and_figures/subplot.py
@@ -26,3 +26,34 @@
26
ax2.set_ylabel('Undamped')
27
28
plt.show()
29
+
30
+#############################################################################
31
+#
32
33
+# Alternative Method For Creating Multiple Plots
34
+# """"""""""
35
36
+# Subplots can also be generated using `subplot()` as in the following example:
37
38
39
+import numpy as np
40
+import matplotlib.pyplot as plt
41
42
43
+x1 = np.linspace(0.0, 5.0)
44
+x2 = np.linspace(0.0, 2.0)
45
46
+y1 = np.cos(2 * np.pi * x1) * np.exp(-x1)
47
+y2 = np.cos(2 * np.pi * x2)
48
49
+plt.subplot(2, 1, 1)
50
+plt.plot(x1, y1, 'o-')
51
+plt.title('A tale of 2 subplots')
52
+plt.ylabel('Damped oscillation')
53
54
+plt.subplot(2, 1, 2)
55
+plt.plot(x2, y2, '.-')
56
+plt.xlabel('time (s)')
57
+plt.ylabel('Undamped')
58
59
+plt.show()
0 commit comments