user113819
user113819

Reputation: 3

Scatter plot in matplotlib origin aligned

I've looked all over the net for this incredibly simple thing and can't find it.

I have a list of (x,y) points and want to plot them, with the origin in the lower left, grid marks showing 0,1,2,3,4... on each axis, and orange dots. How do I do this?

Upvotes: 0

Views: 3541

Answers (1)

M4rtini
M4rtini

Reputation: 13539

Fairly basic, you should look a bit around in the matplotlib documentation, the examples or gallery section shows a lot of different stuff and the code that generated it.

import matplotlib.pyplot as plt
import numpy as np

#Random sample data
x = np.random.random_integers(0, 5, 10)
y = np.random.random_integers(0, 5, 10)

plt.scatter(x,y, c='orange')
plt.ylim([0, y.max()])
plt.xlim([0, x.max()])
plt.grid()
plt.show()

Upvotes: 2

Related Questions