Created
September 22, 2018 19:33
-
-
Save bhushanbrb/018ff08da81ffa2782c3ca2df7115f48 to your computer and use it in GitHub Desktop.
DecisionBoundryColor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#%matplotlib notebook | |
%matplotlib inline | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib import colors as c | |
import time | |
fig = plt.figure() | |
ax = fig.gca() | |
resolution=200 | |
xs = np.linspace(-3., 3., resolution) | |
ys = np.linspace(-3., 3., resolution) | |
xx, yy = np.meshgrid(xs, ys) | |
zz=2*xx+4*yy-5 | |
zz[zz<0]=-1 | |
zz[zz>0]=+1 | |
cMap = c.ListedColormap(['r','g']) | |
quad = ax.pcolormesh(xs, ys, zz,cmap=cMap) | |
positive = np.array([[2, 2], [1, 2]]) | |
negative = np.array([[0, 0], [-1, -2]]) | |
plt.plot(positive[:, 0], positive[:,1], 'ro', markersize=10) | |
plt.plot(negative[:, 0], negative[:,1], 'yo', markersize=10) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment