I want to get a chart similar to the one pubished here. In my dataset I have 3 features and 1 binary target. When target=0, then the dots should be colored e.g. in red. When target=1, then the dots should be colored e.g. in blue.
When I run this code, it looks like all dots have the same color:
from pandas.tools.plotting import scatter_matrix
scatter_matrix(df, alpha=0.2, figsize=(6, 6), diagonal='kde')
To plot this data using the
plotting tools, as you are now, pass
color=['blue' if target == 1 else 'red'] as an argument.
However, I recommending using the
pairplot facility instead. This will result in a plot that is much closer to the one in the tutorial, and to colorize based on a data point you need only specify
hue='my_data_column' as a parameter. Cf. here.