多分このようなもの:
import matplotlib.pyplot
import pylab
x = [1,2,3,4]
y = [3,4,8,6]
matplotlib.pyplot.scatter(x,y)
matplotlib.pyplot.show()
編集:
私があなたのことを正しく理解しているかどうか見てみましょう:
あなたが持っている:
test1 | test2 | test3
test3 | 1 | 0 | 1
test4 | 0 | 1 | 0
test5 | 1 | 1 | 0
ここで、上記の値を散布図で表し、値 1 がドットで表されるようにします。
結果が 2-D リストに格納されているとします。
results = [[1, 0, 1], [0, 1, 0], [1, 1, 0]]
それらをプロットできるように、それらを 2 つの変数に変換します。
そして、このコードであなたが探しているものが得られると思います:
import matplotlib
import pylab
results = [[1, 0, 1], [0, 1, 0], [1, 1, 0]]
x = []
y = []
for ind_1, sublist in enumerate(results):
for ind_2, ele in enumerate(sublist):
if ele == 1:
x.append(ind_1)
y.append(ind_2)
matplotlib.pyplot.scatter(x,y)
matplotlib.pyplot.show()
をインポートする必要があることに注意してくださいpylab
。軸ラベルをいじる必要があります。また、これは回避策のように感じられ、これを行うための直接的な方法があるかもしれません (おそらくあります)。