Tuesday, April 20, 2021

#21Y001 self-teaching - scatterplot

brief description: scatterplot 
result:

sample code:
learned new techniques
categories = np.unique(midwest['category'])

np.unique outputs the number of unique labels
colors = [plt.cm.tab10(i/float(len(categories)-1)) for i in range(len(categories))]

plt.cm.tab10, cm is colourmap, tab10 is the colormap in matplotlib
for loop >>> data=midwest.loc[midwest.category==one]

the ‘for loop’ iterates items within each category label and plot them in one colour

No comments:

Post a Comment