0
votes

I have two numpy arrays y_prob and dataY whose values correspond. dataY is a one dimensional array where each value is a 1 or a 0. y_prob is a two dimensional array. I wish to plot a scatter plot using y_prob to determine the location and dataY to determine the color of the point. How can I do this?
Sample data:

y_prob = [[0.5,0.5], [0.3,0.7], [0.2,0.8], [0.1,0.9]]
dataY = [1,0,0,0]
1

1 Answers

1
votes

You can use the standard packages numpy & matplotlib

import numpy as np
import matplotlib.pyplot as plt

y_prob = np.array([[0.5,0.5], [0.3,0.7], [0.2,0.8], [0.1,0.9]])
dataY = [1,0,0,0]

fig = plt.figure()
plt.scatter(x=y_prob[:,0], y=y_prob[:,1], c=dataY)
fig.show()