Given the following data frame:
import pandas as pd
df = pd.DataFrame({'X':[1,2,3],
'Y':[4,5,6],
'Site':['foo','bar','baz']
})
df
Site X Y
0 foo 1 4
1 bar 2 5
2 baz 3 6
I want to iterate through rows in the data frame to produce 3 scatter plots (in this case, though a general solution for n rows is needed):
One in which the dot for "foo" is red and the rest are blue,
another in which the dot for "bar" is red and the rest are blue,
and a third in which the dot for "baz" is red and the rest are blue.
Here's a sample for "foo" done manually:
import matplotlib.pyplot as plt
%matplotlib inline
color=['r','b','b']
x=df['X']
y=df['Y']
plt.scatter(x, y, c=color, alpha=1,s=234)
plt.show()
Thanks in advance!