Last active
January 28, 2018 17:22
-
-
Save hackintoshrao/b68a63c071e74ef1c9e434f8cce593d6 to your computer and use it in GitHub Desktop.
The scatter plot of university admission data.
This file contains hidden or 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 inline | |
import matplotlib | |
import matplotlib.pyplot as plt | |
import numpy as np | |
# extract data frame columns into numpy array. | |
test_scores = data["test_scores"].values | |
grades = data["grades"].values | |
label = data["accepted"].values | |
# There's a total of 100 student records. | |
print("Total number of records: ", len(test_scores)) | |
# plot the points. | |
# The green points indicates the students who are accepted. | |
# The red ones indicate the ones who are rejected. | |
colors = ['green','red'] | |
fig = plt.figure(figsize=(4,4)) | |
plt.scatter(test_scores, grades, c=label, cmap=matplotlib.colors.ListedColormap(colors)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment