1

Please consider the following code, which is from here:

from matplotlib import pyplot
from mpl_toolkits.mplot3d import Axes3D
from numpy.random import rand
from pylab import figure


m=rand(3,3) # m is an array of (x,y,z) coordinate triplets

fig = figure()
ax = Axes3D(fig)


for i in range(len(m)): #plot each point + it's index as text above
 ax.scatter(m[i,0],m[i,1],m[i,2],color='b') 
 ax.text(m[i,0],m[i,1],m[i,2],  '%s' % (str(i)), size=20, zorder=1,  
 color='k') 

ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
pyplot.show()

It creates the following graph: enter image description here

How can I add a highlighted area in a corner of the plot, for example where x > .7, y > .5, and z <.1? The desired graph should look like this, but with the highlighted area being 3D as well: enter image description here

What I tried is:

surf = ax.plot_surface(np.array([.7, .75]), np.array([.5, .65]), np.array([[0], [.1]]), rstride=1, cstride=1, facecolors='y', linewidth=0, antialiased=False, shade=False)

While this does the highlighting, it does not create the 3D highlighted region I am looking for.

Saeed
  • 1,848
  • 1
  • 18
  • 26

0 Answers0