I'm attempting to run a Matplotlib example that requires the use of mpl_toolkit mplot3d. I'm running Anaconda on a MackBook Pro running Mac OS X 10.10.3. I have the latest version of Anaconda and Matplotlib installed. I also installed Basemap which as I understand it also installs mpl_toolkits at the same time.

The sample program is attached to this posting. I get the following error message when I run it:


/*Traceback (most recent call last):*//*
*//* File "/Users/user/coursera - programming for everybody (python)/Week - 06/3d-line.py", line 2, in <module>*//*
*//*    from mpl_toolkits.mplot3d.axes3d import Axes3D*//*
*//*ImportError: No module named mpl_toolkits.mplot3d.axes3d*/


Any suggestions?


Sam Dupree.
import matplotlib as mpl
from mpl_toolkits.mplot3d.axes3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt

mpl.rcParams['legend.fontsize'] = 10

fig = plt.figure()
ax = fig.gca(projection='3d')
theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
z = np.linspace(-2, 2, 100)
r = z**2 + 1
x = r * np.sin(theta)
y = r * np.cos(theta)
ax.plot(x, y, z, label='parametric curve')
ax.legend()

plt.show()
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to