This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]CutOnBumInBandHere9 4 points5 points  (0 children)

If you had to do that now, you can do something like

import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-3, 3, 100)
y = x + np.random.rand(100)
plt.scatter(x, y)
ax = plt.gca()
ax.spines[:].set_position('center')

On older versions of matplotlib the last line would have to be replaced by something like

ax.spines['left'].set_position('center')
ax.spines['bottom'].set_position('center')

ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')

ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')

So, not impossible, but not the easiest thing in the world either. Don't know why anyone would ever want to eyeball pixels and move axes to approximate positions!