Вопрос

I am pretty new to programing in python and I have a question. So I want to draw 2D coordinate space in 3D so I could add points in space and show rotations around (0,0) for (2,1) of 2D space by 90°,120° and 60°. Problem is that I don't know how to draw 2D coordinate space in 3. Can someone suggest me any solution how to place 2D in 3D using matplotlib?

Here is example of code I've made so far...

from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111,projection='3d')

x = 2
y= 1

ax.scatter(x, y, 0, zdir='y')

#size of 3d  
ax.legend()
ax.set_xlim3d(0, 10)
ax.set_ylim3d(0, 10)
ax.set_zlim3d(0, 10)

plt.show()
Это было полезно?

Решение

You might want to look at the examples found on the mplot3d tutorial

http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html#tri-surface-plots

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top