I am making a line plot of the array A
. Is there a way to convert it to a scatter plot? I present the current output for reference.
import numpy as np
import matplotlib.pyplot as plt
A=np.array([[0.02109 ],
[0.02109 ],
[0.0201082 ],
[0.02109 ],
[0.02109 ],
[0.02109 ],
[0.02055473],
[0.02055797],
[0.02109 ],
[0.02109 ],
[0.02109 ],
[0.02109 ]])
plt.title("Line graph")
plt.plot(A, color="red")
The current output is
CodePudding user response:
A scatter plot requires 2 variables, you only have one here.
I believe you rather want a line plot without line and with the individual points:
plt.plot(A, color="red", ls='', marker='o')
Output: