1 year ago

#217593

test-img

Rema Thomas

Unrecognized marker array

I am trying to plot a 3D scatter plot in matplotlib and for some reason I keep getting this unrecognized marker error. I am not sure how to fix this error. This is my code so far:

def display_3d_data(lp) :   

fig = plt.figure(figsize = (8, 8))
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = lp["X"][:,0]
y = lp["X"][:,1]
z = lp["X"][:,2]
labels = lp["y"]
color = np.array(["red", "green"])
marker = np.array([".", "^"])

for i in range(len(x)) :
  ax.scatter(x[i], y[i], z[i],cmap=color,marker=marker)
ax.set_xlabel('Feature 1')
ax.set_ylabel('Feature 2')
ax.set_zlabel('Feature 3')
plt.show()   

%matplotlib notebook
display_3d_data(lp1)

This is the error I keep getting:

ValueError: Unrecognized marker style array(['.', '^'], dtype='<U1')

and for this I need a triangle and dot style marker.

Expected Output: output

python

matplotlib

scatter3d

0 Answers

Your Answer

Accepted video resources