【发布时间】:2020-09-12 21:30:27
【问题描述】:
我在 Google Colab 上运行了以下代码,但我认为它应该在输出上绘制图表!这是对还是错? 代码:
# plotting a scatter matrix
from matplotlib import cm
from pandas.plotting import scatter_matrix
X = fruits[['height', 'width', 'mass', 'color_score']]
y = fruits['fruit_label']
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)
cmap = cm.get_cmap('gnuplot')
scatter=pd.plotting.scatter_matrix(X_train, c= y_train, marker = 'o', s=40, hist_kwds={'bins':15},
figsize=(9,9), cmap=cmap)
scatter
我得到如下输出:
【问题讨论】:
-
我无法重现您的情况,我尝试使用示例
DataFrame并显示图表 -
它对我来说很好用,这里是screenshot。我建议重新启动运行时并重试
-
好的,太好了!
标签: python pandas plot google-colaboratory