22 lines
355 B
Python
22 lines
355 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
import sys
|
||
|
import numpy as np
|
||
|
import matplotlib.pyplot as plt
|
||
|
|
||
|
FILENAME = sys.argv[1] # CSV file
|
||
|
|
||
|
data = np.loadtxt(FILENAME, delimiter=',')
|
||
|
|
||
|
D = data[0].size - 1 # Number of dimensions
|
||
|
|
||
|
assert D <= 2
|
||
|
assert D > 0
|
||
|
|
||
|
X = data[:, 0]
|
||
|
Y = data[:, 1] if D > 1 else np.zeros(len(data))
|
||
|
C = data[:, -1]
|
||
|
|
||
|
plt.scatter(X, Y, c=C)
|
||
|
plt.show()
|