function:pd.plotting.scatter_matrix中是否有scatter3D的cmp(colormaps)之类的参数?

Is there a parameter like cmp(colormaps) of scatter3D in function: pd.plotting.scatter_matrix?

我有这样的代码,按标签分类:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import datasets

iris = datasets.load_iris()
X = iris.data
y = iris.target
df = pd.DataFrame(X, columns = iris.feature_names)

pd.plotting.scatter_matrix(df, c=y)

但是,我希望在结果中有一个定性的颜色图,比如 cmap

中的 'Dark2'
fig = plt.figure()
ax = plt.axes(projection = '3d')
ax.scatter3D(df.values[:,0], df.values[:,1], df.values[:,2], c=y, cmap = 'Dark2')
plt.show()

有什么办法可以实现吗,另外,我有办法in other question

color_wheel = {1: "#0392cf", 
               2: "#7bc043", 
               3: "#ee4035"}
colors = iris_data["target"].map(lambda x: color_wheel.get(x + 1))

在做散点图之前添加了一个color_wheel,但是问题是我不知道颜色是否定性,当label的个数不确定时...

所有 **kwargs 都与 scatter_matrix are passed to pyplot.scatter 不匹配 因此,如果不需要将特定颜色分配给特定组,则 cmap 可以直接传递给 scatter_matrix

pd.plotting.scatter_matrix(df, c=y, cmap='Dark2')