I have a pandas DataFrame with 3 columns, shown below.
col1 value flag 1 0 0 2 0.03915 0 3 0.13 1>
You can use the built-in df.plot.scatter() function and pass the flag column to the color argument:
df.plot.scatter()
flag
color
import pandas as pd idx = [1,2,3] value = [0., 0.03, 0.13] flag = [0, 0, 1] df = pd.DataFrame(dict(idx=idx, value=value, flag=flag)) df.plot.scatter('idx', 'value', c='flag', cmap='RdBu_r')