My code has the line below
ax1.scatter(data1[0], data1[1], marker='o', s=20,
color = ['k','b','g','r','m'],
edgecolors= ['k','b','g','r','m'])
I would like to have the marker = ('o','d','v','^','x')
for the different shapes, but this does not work. How can I revise my code like above to give the different shapes for the different individual points.
Unlike color
and edgecolors
, the marker
parameter is not defined as an "array-like" parameter : https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html
You can loop over the data and set the symbol for each individual point:
markers = ['o','d','v','^','x']
colors= ['k','b','g','r','m']
edgecolors = ['k','b','g','r','m']
for i in range(len(data1[0])):
ax1.scatter(data1[0][i], data1[1][i],
marker = markers[i],
s = 20,
c = colors[i],
edgecolors= edgecolors[i] )