I am reading a text file and I want to plot these columns( y and z) but if x column value is 'out', 6 and 4 point colour should be red. In this logic, there are 6 points in the graph but 4 point should be blue, and other two colour should be red. There are two graph and every pragh has 3 point. How can I do that?
#-------input.dat---------
# x y z
# col 1 col 2 col 3
# res 5 5
# out 6 4
# res 7 3
import matplotlib.pyplot as plt
import numpy as np
data[] =[]
with open('input.dat', skip_header=2,'r') as f:
lines = f.readlines()
for line in lines[2:]:
data.append(list(line.split()))
y = (data[:, 2])
z = (data[:, 3])
------------------------
plt.plot(float(line[1]),b+)
for line in enumerate(data)
if line[0] == 'OUT'
plt.plot(float(line[1]),r+)
-----------------------
plt.subplot(211)
plt.plot(y, 'b+', label=" Y figure ")
plt.subplot(212)
plt.plot(z, 'b+', label=" Z figure ")
plt.show()