I'm a data analyst who recently converted from R to Python. In R I can take input a matrix into a function that can generate a scatter plot. But, is that also possible in Python?
I visited other posts related to my question, but it appears they first created separate lists for each variable then produced a scatterplot from that. But, I'd like to keep my variables under a single data structure as I have below. But, I'm getting an error when the program executes the line with scatter function.
I would appreciate your input on this matter.
x = 0
data = []
for n in range(15):
x = random.uniform(0, 10)
b = random.uniform(2,5)
m = random.uniform(.5,6)
y = x*m + b
data.append((round(x,2),round(y,2)))
mat = np.matrix(data)
matplotlib.pyplot.scatter(mat[:,0],mat[:,1])
matplotlib.pyplot.show()
matin before last line?