I have a pandas dataframe df, it has a column which I use to create a color code column for matplotlib this way
df['color-code'] = np.where(df['Community School?']=='Yes', 'blue', 'red')
I also create a separate dataframe to use without null values for plotting
sc_income = df[~df['Economic Need Index'].isnull() & ~df['School Income Estimate'].isnull()]
Then I plot it using
#make plot bigger
plt.rcParams['figure.figsize'] = (40,20)
#plot Economic Need Index vs School Income Estimate
scatter(sc_income['Economic Need Index'], sc_income['School Income Estimate'], c=sc_income['color-code'])
plt.xlabel('Economic Need')
plt.ylabel('School Income $')
plt.title('Economic Need vs. School Income')
plt.legend()
plt.show()
Final plot looks like this
The legend that's needed though should specify blue means community school, red means not community school.
