Error coming for plotting

Hi
I tried to make a 3d figure as shown in tutorial video but I’m getting an error. Following is my code
import matplotlib.pyplot as plt
fig=plt.figure()
axes=fig.gca(projection=‘3d’)
plt.show()

It’s showing following errors:
get_projection_class(projection)
57 try:
—> 58 return projection_registry.get_projection_class(projection)
59 except KeyError:

KeyError: ‘3d’

ValueError Traceback (most recent call last)
in
1 import matplotlib.pyplot as plt
2 fig=plt.figure()
----> 3 axes=fig.gca(projection=‘3d’)
4 plt.show()

1931 # no axes found, so create one which spans the figure
-> 1932 return self.add_subplot(1, 1, 1, **kwargs)
1933
1934 def sca(self, a):

ValueError: Unknown projection ‘3d’

hey @pasta,

To enable 3d plotting in matplotlib you need to make another import .
just copy paste this command :

from mpl_toolkits.mplot3d import Axes3D

I hope this would have resolved your doubt.
Thank You and Happy Learning :slightly_smiling_face:.