Plotting scatterplots

Scatterplots can be used to effectively understand whether the variables are in a nonlinear relationship, and you can get an idea about their best possible transformations to achieve linearization. If you are using an algorithm based on linear combinations, such as linear or logistic regression, figuring out how to render their relationship more linearly will help you achieve a better predictive power:

In: colors_palette = {0: 'red', 1: 'yellow', 2:'blue'}    colors = [colors_palette[c] for c in groups]    simple_scatterplot = iris_df.plot(kind='scatter', x=0, y=1, c=colors)

After running the code, a nicely drawn scatterplot will appear:

Scatterplots can be turned into hexagonal binning plots. In addition, they help you ...

Get Python Data Science Essentials - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.