ValueError: Unknown projection '3d' (once again)
You will have to import Axes3D
to enable the 3d plotting in matplotlib. The official tutorials on 3d plotting can be found here. So the correct imports and code would look like
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # <--- This is important for 3d plotting
#your code
fig = plt.figure()
ax = fig.gca(projection='3d')
![Leos313](https://i.stack.imgur.com/gwGt0.jpg?s=256&g=1)
Leos313
Enthusiasm, initiative, curiosity, and dynamism have always pushed him during the academic education and work. He always sets goals, looking for something that allows him to grow personally, professionally, and especially culturally. He still doesn´t know why he is describing himself in the third person. Strong motivation for professional development in the following areas: Embedded System and Firmware development High-Performance Computing Hardware Accelerator Parallel Computing Machine learning |___|_O_|___| |___|___|_O_| |_O_|_O_|_O_| Some open-source works can be found here.
Updated on July 09, 2022Comments
-
Leos313 almost 2 years
When executing this line of code:
import matplotlib.pyplot as plt #your code fig = plt.figure() ax = fig.gca(projection='3d')
I have an output error:
raise ValueError("Unknown projection %r" % projection) ValueError: Unknown projection '3d' <Figure size 432x288 with 0 Axes>
The error appears also when I use Spyder as IDE. The version of
matplotlib
isprint('matplotlib: {}'.format(matplotlib.__version__)) matplotlib: 1.5.0rc3
But I had the same problem even with other versions of
matplotlib
. A similar error was reported in this question (Stackoverflow) but the answers do not help. Some suggestions on how to modify the instruction? matplotlib: 3.0.2