0
$\begingroup$

x = np.random.rand(200) and y = 12 * x - 4 + np.random.randn(200)
After ploting the (x,y) values I get the following graph in matplotlib:
enter image description here
How can I configure the axis so all samples are clearly visible?

$\endgroup$

1 Answer 1

0
$\begingroup$

You could try the scatter function.

import matplotlib.pyplot as plt
import numpy as np

x = np.random.rand(200)
y = 12 * x - 4 + np.random.randn(200)

plt.plot(x, y, '.')
plt.show()

or change the last part

plt.scatter(x, y, marker='o')
plt.show()

take a look at some great resources: Jakevdp blog and Matplotlib's own documentation

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.