Jun-11-2023, 10:16 AM
Hello,
i want to plot 3 different 2D curves in a 3D coordinate system, so lets say 3 simple sine functions. One in x and y direction, one in x and z direction and one y and z direction.
My Code already looks like:
Can someone help me with this? Thank you in advance,
Maxi
i want to plot 3 different 2D curves in a 3D coordinate system, so lets say 3 simple sine functions. One in x and y direction, one in x and z direction and one y and z direction.
My Code already looks like:
ax = plt.figure().add_subplot(projection='3d') # Plot a sin curve using the x and y axes. x = np.linspace(0, 1, 100) y = np.sin(x * 2 * np.pi) / 2 + 0.5 ax.plot(x, y, zs=0, zdir='z', label='curve in (x, y)') y = np.linspace(0, 1, 100) z = np.sin(x * 2 * np.pi) / 2 + 0.5 ax.plot(xs=0,ys=y,xz=z, zdir='z', label='curve in (y, x)') # Make legend, set axes limits and labels ax.legend() ax.set_xlim(0, 1) ax.set_ylim(0, 1) ax.set_zlim(0, 1) ax.set_xlabel('X') ax.set_ylabel('Y') ax.set_zlabel('Z')But it throws an Error:
Error:x and y must have same first dimension, but have shapes (1,) and (100,)
With only one function in x and y direction it works just fine.Can someone help me with this? Thank you in advance,
Maxi