I am trying to create a surface plot on an external visualization platform. I\'m working with the iris data set that is featured on the sklearn decision tree documentation p
@kazemakase's approach is the "right" one. For completeness sake, here is simple way to get every "pixel" in Z that is a decision boundary:
steps = np.diff(Z,axis=0)[:,1:] + np.diff(Z,axis=1)[1:,:]
is_boundary = steps != 0
x,y = np.where(is_boundary)
# rescale to convert pixels into into original units
x = x.astype(np.float) * plot_step
y = y.astype(np.float) * plot_step
Plot of is_boundary (dilated so one can see all non-zero entries):