Hi all,
I'm trying to produce a graph in which two different sets of axes are
superimposed, with both x- and y- ticks taking on different ranges.
I've managed to get the first set of axes to place its ticks on the
bottom and left of the figure, and the second set to place its ticks
on the top and right, however, xlabel and ylabel behave in an
unexpected manner: for the bottom-left axes, xlabel and ylabel place
text in the correct location, however, for the "top-right" axes,
xlabel and ylabel misbehave, placing the axis label text at the bottom
(for xlabel) and the left (for ylabel), but positioned closer to the
axis lines.
This seems to be due to some sort of bug with the "alignment" keyword
for xlabel and ylabel: i.e. alignment = "top" or alignment = "right"
does not behave as I would have expected.
I'm sorry if this has been reported before; I wasn't able to find
anything useful in the archives or elsewhere on the web.
See below for a simple example.
Thanks for your help!
Duncan
···
----
from pylab import *
fig = figure()
ax1 = fig.add_axes([0.1,0.1,0.8,0.8],label='axes 1')
ax2 = fig.add_axes([0.1,0.1,0.8,0.8],label='axes 2')
plot1 = ax1.plot([1,2,3],[1,2,3])
plot2 = ax2.plot([4,5,6],[3,2,1])
ax1.axis([0,4,0,4])
ax1.set_xlabel('bottom')
ax1.set_ylabel('left')
ax2.axis([3,7,0,4])
ax2.xaxis.tick_top()
ax2.yaxis.tick_right()
ax2.set_xlabel('top') # I expected this to place the word "top"
at the top of the figure, corresponding to the ticks for ax2's x-axis
ax2.set_ylabel('right') # I expected this to place the word
"right" at the right of the figure, corresponding to the ticks for
ax2's y-axis
ax2.axesPatch.set_fill(False) # so that you can see through to ax1
fig.canvas.draw()