Hi, I was trying some code from WesMckinney's python data analysis book in ipython environment,which is built in anaconda. When I typed the simple code like
import matplotlib.pyplot as plt
fig = plt.figure
ax1 = fig.add_subplot(2,2,1)
Traceback (most recent call last):
File "<ipython-input-9-559e30a6412a>", line 1, in <module>
ax1 = fig.add_subplot(2,2,1)
AttributeError: 'function' object has no attribute 'add_subplot'
An AttributeError arose, but it's weird since anaconda is surely installed with matplotlib module. So Any suggestion? thank you.
fig = plt.figure(). Otherwise, you assign the function to fig, not the resulting generated figure.