I have a question I have a dataset which contain 1200060 rows and 3 column. column contain points and I have to draw a 3D plot for it. I'm using the code below but I don't know where is the error.
fig = plt.figure()
ax = plt.axes(projection="3d")
count = len(data1.index)
z_line = np.linspace(0, count, 1000)
x_line = np.cos(z_line)
y_line = np.sin(z_line)
ax.plot3D(x_line, y_line, z_line, 'gray')
z_points = count * data1[['z']]
x_points = np.cos(z_points) + 0.1 * data1[['x']]
y_points = np.sin(z_points) + 0.1 * data1[['y']]
ax.scatter3D(x_points, y_points, z_points, c=z_points, cmap='hsv')
plt.show()
error is:
ValueError: shape mismatch: objects cannot be broadcast to a single shape
I tried this one too but unsuccessful
fig = plt.figure()
ax = plt.axes(projection="3d")
x = np.linspace(len(data1['z'].index), len(data1['y'].index), len(data1['x'].index))
y = np.linspace(len(data1['z'].index), len(data1['y'].index), len(data1['x'].index))
X = data1[['x']]
Y = data1[['y']]
Z = data1[['z']]
fig = plt.figure()
ax = plt.axes(projection="3d")
ax.plot_wireframe(X, Y, Z, color='green')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
plt.show()
this one run but didn't show any output
and using this one same error as the first one
fig = plt.figure()
ax = plt.axes(projection="3d")
num_bars = len(data1.index)
x_pos = data1[['x']], num_bars
y_pos = data1[['y']], num_bars
z_pos = data1[['z']], num_bars
x_size = np.ones(num_bars)
y_size = np.ones(num_bars)
z_size = np.ones(num_bars)
ax.bar3d(x_pos, y_pos, z_pos, x_size, y_size, z_size, color='aqua')
plt.show()
error: ValueError: shape mismatch: objects cannot be broadcast to a single shape