how to do multiple scatter plots with matploatlib

You are a Udacity Machine Learning student?

Something like this might be useful for you:

import numpy as np
import matplotlib.pyplot as plt

labels = ['output','varA','varB','varC']

data = np.array([[4,5,6,2,5],
                [4,1,1,44, 7]])

colors = ["r", "g", "b", "k"] # make sure you have enough colors to match 
                              # the number of variables
for i in range(1, len(data)):
    plt.scatter(data[1], data[i], c=colors[i-1], s=100, alpha=0.7, label=labels[i])

Hope that helps.


Browse More Popular Posts

Leave a Comment