1

I have a numpy array X that has

[[-2.26188258  0.83339356]
 [-2.04141033  0.84618611]
 [-2.09993514  0.97093103]
 [-2.22863577  0.70044229]
 [-1.98995538  1.04537757]
 [-1.98696162  0.81267152]
 [-2.14523421  0.92106693]]

I want to use pyplot.plot to use the first element of each item as x and the second element as y to plot a scatter plot.

xval = [x[0] for x in X]
yval = [x[1] for x in X]
ax.plot(x = xval, y = yval, marker = 'o', linestyle = 'None', color = dbclrs[i + 1])

this is what I tried, but it gives me an empty plot. I am trying not to use the scatter function.

1 Answer 1

3

The call signature of plot is

plot(*args,*kwargs)

Hence you need to call

ax.plot(xval, yval, marker = 'o', ...)


Also note that if X is your array you can directly plot

ax.plot(X[:,0],X[:,1], ...)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.