1

How can i plot a single 3D point with python?

Ihave tried to plot the point mentioned as the below plot in the code but i am unable to plot.

from mpl_toolkits.mplot3d import Axes3D ###Import axes from 3D
import matplotlib.pyplot as plt ##To plot graphs/pictures
ox, oy, oz = center
corner_1=(ox-w/2,oy-l/2,oz-h/2)
center = [0.2,0.3,0.4]
l=0.3,
w=0.4
h=0.1
plt.plot(corner_1,'ro')
plt.scatter(corner_1)

The point should be plotted at the respected position as it was initialized

1 Answers1

1

Not the most prettiest method, but the following does the job you want.

from mpl_toolkits import mplot3d
import matplotlib.pyplot as plt ##To plot graphs/pictures
import numpy as np

center = [0.2,0.3,0.4]

l=0.3
w=0.4
h=0.1

ox, oy, oz = center
# corner_1=([ox-w/2],[oy-l/2],[oz-h/2])

fig = plt.figure()
ax = plt.axes(projection='3d')

ax.plot3D([ox-w/2],[oy-l/2],[oz-h/2], 'ro')

plt.show()
Achintha Ihalage
  • 2,310
  • 4
  • 20
  • 33
  • I too got the same thought but initialized in different manner. Now with a new question. I have drawn 8 points and want to rotate with the rotation matrix and want to for surface cube. These 8 points are the vertices of the cube. Can you explain how can i? – Pradeep Chakravarthi Nutakki Jun 08 '19 at 15:39