I want to make a plot from a data file with matplotlib.pyplot and I want every marker (triangle) to have an orientation which has been given in the input file.
The input file :
x y angle
1 1 10
1.2 1.2 20
1.3 1.3 30
and this is my code:
import numpy as np
import matplotlib.pyplot as plt
infile = open ('traj_marker.txt')
#for s in xrange(8):
x, y = [], []
m = []
for i in xrange(3):
data = infile.readline()
raw = data.split()
x.append(float(raw[0]))
y.append(float(raw[1]))
m.append(float(raw[2]))
xnp = np.array(x)
ynp = np.array(y)
mnp = np.array(m)
fig, ax = plt.subplots()
ax.scatter(xnp, ynp, 100, marker = (3,0,mnp))
plt.xticks (range(1,3))
plt.yticks (range(1,3))
plt.grid()
fig.savefig ('trj.png')
infile.close()
But the presence of array mnp in marker produces error. How can I solve this?