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 a2ee71b commit 2f83e1cCopy full SHA for 2f83e1c
res/lecture-code/lecture-9.py
@@ -65,6 +65,20 @@ def f(t):
65
plt.show()
66
67
68
+def object_oriented_plotting():
69
+ """
70
+ An example of object-oriented Matplotlib.
71
72
+ fig = plt.figure()
73
+ print(type(fig)) # => matplotlib.figure.Figure
74
+
75
+ ax = fig.add_subplot(1, 1, 1)
76
+ print(type(ax)) # => matplotlib.axes._subplots.AxesSubplot
77
78
+ ax.plot([1, 4, 9, 16])
79
+ plt.show()
80
81
82
def histogram():
83
"""
84
Plot a histogram.
@@ -101,6 +115,7 @@ def main():
101
115
simple_plot()
102
116
plot_customizations()
103
117
multiple_subplots()
118
+ object_oriented_plotting()
104
119
histogram()
105
120
scatter_plot()
106
121
0 commit comments