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 e0415f9 commit b2a2dccCopy full SHA for b2a2dcc
examples/pylab_examples/simple_plot.py
@@ -7,13 +7,19 @@
7
import matplotlib.pyplot as plt
8
import numpy as np
9
10
+# Data for plotting
11
t = np.arange(0.0, 2.0, 0.01)
12
s = 1 + np.sin(2*np.pi*t)
-plt.plot(t, s)
13
14
-plt.xlabel('time (s)')
15
-plt.ylabel('voltage (mV)')
16
-plt.title('About as simple as it gets, folks')
17
-plt.grid(True)
18
-plt.savefig("test.png")
+# Note that using plt.subplots below is equivilent to using
+# fig = plt.figure and then ax = fig.add_subplot(111)
+fig, ax = plt.subplots()
+ax.plot(t, s)
+
19
+ax.set(xlabel='time (s)', ylabel='voltage (mV)',
20
+ title='About as simple as it gets, folks')
21
+ax.grid()
22
23
+fig.savefig("test.png")
24
plt.show()
25
0 commit comments