Matplotlib Tutorial 29 - matplotlib 3d intro

preview_player
Показать описание
Hello and welcome to a 3D graphing in Matplotlib tutorial. Three dimensional graphing in Matplotlib is already built in, so we do not need to download anything more.

Рекомендации по теме
Комментарии
Автор

I had the following error: AttributeError: 'list' object has no attribute 'ndim'. I had to change ax1.plot_wireframe(x, y, z) to ax1.plot(x, y, z). Now, it works.

toastersman
Автор

x = list(range(1, 1000))
y = [math.log(i, 2) for i in x]
z = [math.sin(i/10) for i in x]

Gives you a nice plot :)

AkshayAradhya
Автор

For people who are using some different IDE's such as jupyter or spyder:
use command %matplotlib tk to be able to get a 3D output.
Many IDEs do not have pop up images as default

pushkardeshpande
Автор

how would you plot iris target values?

hardikvegad
Автор

I'm getting an error: Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
ax1.plot_wireframe(x, y, z)
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 1848, in plot_wireframe
if Z.ndim != 2:
AttributeError: 'list' object has no attribute 'ndim'
What's up with that?
I used your code exactly as is.

mwendwakiko
Автор

How we can move plotted image in jupyter notebook

adityarajora
Автор

The following works just fine, without the common errors:


from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import style

style.use('ggplot')

fig = plt.figure()
ax = Axes3D(fig)

x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y = [5, 6, 7, 8, 2, 5, 6, 3, 7, 2]
z = [1, 2, 6, 3, 2, 7, 3, 3, 7, 2]

line = ax.plot(x, y, z)
ax.set_xlabel('X axis')
ax.set_ylabel('Y axis')
ax.set_zlabel('Z axis')

plt.show()

otavioaugustomedolaconquis
Автор

Youtube tutorialists are ruining my work ethic by making things too easy.

jessewaite
Автор

I think that title of video should be "Matplotlib Tutorial 29 - Matplotlib 3d intro". But these is minor detail.

kamilziemian