I am trying to scatter plot lists x and y and color code their points corresponding to list z:
plt.scatter(x,y,c=z)
z is a list of strings with many repeats. example z:
z = ['Adelie', 'Adelie', 'Adelie', 'Adelie', 'Gentoo', 'Gentoo', 'Gentoo', 'Gentoo']
I believe a good way to do this would be by creating a list that transforms the string values of z into integer values, like so:
newz = [1, 1, 1, 1, 2, 2, 2, 2]
Then I believe I could achieve my goals with this code
plt.scatter(x,y,c=newz)
What is the best way to create newz, and is this a good way to color my scatter plot points?