capital-G / musikinformatik-sose2021

Course materials for Musikinformatik course SoSe 2021 at RSH Düsseldorf
https://capital-g.github.io/musikinformatik-sose2021/
7 stars 2 forks source link

minor simplification in plt.scatter #46

Closed telephon closed 3 years ago

telephon commented 3 years ago

in 01_spect_resynth/02_spect.ipynb

instead of plt.scatter(x=data_tsne, y=np.zeros(data_tsne.shape), c=list(range(len(data_tsne))))

can be simplified to plt.scatter(x=data_tsne, y=np.zeros(len(data_tsne)), c=range(len(data_tsne)))

(and in all the other examples)

capital-G commented 3 years ago

did not know that plt also accepts an iterator in this case.

Maybe an even better way would be

plt.scatter(x=data_tsne, y=np.zeros(len(data_tsne)), c=np.arange(len(data_tsne)))

as arange creates a proper array instead of an iterator