user3668129:
私は実行していますpython 3.7.6
し、私は次のことを持っていますdataframe
:
col_1 col_2 col_3 col_4
GP 1 1 1 1
MIN 1 1 1 1
PTS 1 1 1 1
FGM 1 1 0 1
FGA 0 1 0 0
FG% 0 1 1 1
3P Made 0 1 1 0
AST 0 1 1 0
STL 0 1 0 0
BLK 0 1 1 0
TOV 0 0 1 0
私は、プロットしたいdataframe
とscatter plot or other (dot's plot)
場所:
X軸 - データフレームのインデックス
Yは、Axis - データフレームの列を
グラフ上の点からの値に記載されているdataframe
(1 -グラフと0にショーをしません)
どのように私はそれを行うことができますか?
クアンホアン:
私は、散乱についてはよく分からないが、あなたは使用することができますimshow
バイナリ値を表示するには:
fig, ax = plt.subplots()
ax.imshow(df, cmap='gray')
ax.set_xticks(range(df.shape[1]))
ax.set_xticklabels(df.columns)
ax.set_yticks(range(df.shape[0]))
ax.set_yticklabels(df.index)
plt.show()
出力:
アップデート:散布も可能。
plt.scatter(*np.where(df.T))
plt.xticks(range(df.shape[1]), df.columns)
plt.yticks(range(df.shape[0]), df.index)
plt.show()
出力: