मैं मैटलप्लिब के साथ एक साथ विमान और कुछ बिंदुओं को प्लॉट करने की कोशिश कर रहा हूं। मुझे कोई त्रुटि नहीं है बस बिंदु दिखाई नहीं देगा। मैं कुछ बिंदुओं और विमानों पर अलग-अलग समय पर साजिश कर सकता हूं लेकिन कभी भी एक ही समय में नहीं। कोड का हिस्सा दिखाई देता है:मैटलप्लिब - प्लॉट एक विमान और 3 डी में अंक एक साथ प्लॉट करें
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
point = np.array([1, 2, 3])
normal = np.array([1, 1, 2])
point2 = np.array([10, 50, 50])
# a plane is a*x+b*y+c*z+d=0
# [a,b,c] is the normal. Thus, we have to calculate
# d and we're set
d = -point.dot(normal)
# create x,y
xx, yy = np.meshgrid(range(10), range(10))
# calculate corresponding z
z = (-normal[0] * xx - normal[1] * yy - d) * 1. /normal[2]
# plot the surface
plt3d = plt.figure().gca(projection='3d')
plt3d.plot_surface(xx, yy, z, alpha=0.2)
#and i would like to plot this point :
ax.scatter(point2[0] , point2[1] , point2[2], color='green')
plt.show()
संबंधित: https://stackoverflow.com/questions/13464304/how-can-i-plot-a-3d-plane-in-matlab/13473027#13473027 –
तब उपयोग करने के लिए
ax.hold()
कोई आवश्यकता नहीं है @AndreyRubshtein वह कैसे संबंधित है? आपका लिंक 'matlab' के बारे में है, यह' matplotlib' – tomहे @ टॉम के बारे में है, इसमें गणित सूत्र के बारे में एक स्पष्टीकरण है, जिसे मूल प्रश्न –