列表索引必须是整数或切片,散点图中不能浮点数

问题描述 投票:0回答:0

我不知道哪里出错了,我无法创建图表。

存储库:https://github.com/Anderson-Andre-P/Uber-Data-Analysis

plt.scatter(
    embedding[:, 0],
    embedding[:, 1],
    c=[sns.color_palette()[x] for x in df.Monday.map({"Monday": 0, "Tuesday": 1, "Wednesday": 2, "Thursday": 3, "Friday": 4, "Saturday": 5, "Sunday": 6})])

plt.gca().set_aspect('equal', 'datalim')
plt.title('UMAP projection of the Uber dataset', fontsize=24);

Print google collab

python matplotlib scatter-plot
© www.soinside.com 2019 - 2024. All rights reserved.