1 Sep 16:46
spines with 'axes' positions show in wrong place?
Do the right and top spines display correctly when the position is set
using 'axes' coordinates?
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
x = np.linspace(0,2*np.pi,100)
y = 2*np.sin(x)
ax = fig.add_subplot(1,1,1)
ax.set_title('centered spines')
ax.plot(x,y)
ax.spines['right'].set_position(('axes',0.1))
ax.yaxis.set_ticks_position('right')
ax.spines['top'].set_position(('axes',0.25))
ax.xaxis.set_ticks_position('top')
ax.spines['left'].set_color('none')
ax.spines['bottom'].set_color('none')
fig.savefig('test.png',bbox_inches='tight')
Notice that the top spine is 0.25 in axes coordinates, where 0 in the
axes coordinates is the *top* of the picture, and positive goes up. I'd
expect that 0.25 in axes coordinates be 25% from the bottom of the
picture, or that the coordinates would be reversed for the top spine and
the top spine would be positioned 25% from the top of the picture.
Having it jump above the picture was a surprise. I noticed the same
sort of issue for the right spine, as illustrated above as well.
Of course, it may be that I'm just not understanding something...
Thanks,
(Continue reading)
RSS Feed