Skip to content
Sign upLog in
← Back to Community

test

Profile icon
lij12

def plotData(X,y):

plots the data points with o for the positive examples and x for the negative examples. output is saved to file graph.png

fig, ax = plt.subplots(figsize=(12,8))

insert your code here

positive = y>0
negative = y<0
ax.scatter(X[positive,0], X[positive,1], c='b', marker='o', label='Healthy')
ax.scatter(X[negative,0], X[negative,1], c='r', marker='x', label='Not Healthy')
ax.set_xlabel('Test 1')
ax.set_ylabel('Test 2')
fig.savefig('graph.png')