-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_data.py
More file actions
23 lines (20 loc) · 753 Bytes
/
plot_data.py
File metadata and controls
23 lines (20 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import matplotlib.pyplot as plt
import os
def plot_data(X, title_string, ax):
"""
:param X : 2D array of our dataset
:param y : 1D array of the groundtruth labels of the dataset
:param ax : existing subplot, to draw on it
"""
# clear subplot from previous (if any) drawn stuff
ax.clear()
# set label of horizontal axis
ax.set_xlabel('f1')
# set label of vertical axis
ax.set_ylabel('f2')
# scatter the points, with red color
ax.scatter(X[:,0], X[:,1], c='black', marker='.', label=title_string)
# add legend to the subplot
ax.legend()
# Pause for a short time, to allow the plotted points to be shown in the figure
plt.pause(0.001)