I am trying to change the position of the xlabel/ylabel with respect to the
xaxis/yaxis. Particularly, I was trying to get the "xlabel" closer to the
"xaxis" and the "ylabel" closer to the "yaxis", for which I was using the
lines indicated with '#<-------' in the following sample code:
from pylab import *
from numpy import *
x = linspace(0,1,10)
y = x**2
xlabel('xname', position=(0.5,0.1)) #<------
ylabel('yname', position=(0.1,0.5)) #<------
My understanding was that "position=(xpos,ypos)" would place the label
anywhere I wanted, though there is problem. Let me take "xlabel" as an
example. I can successfully move the "xlabel" parallel to the "xaxis" by
setting the quantity "xpos" anywhere from 0 to 1 (0.5 being the center of
the "xaxis"). However, for moving the "xlabel" closer to or further from the
"xaxis" I change the value of "ypos" but it does NOT do anything, i.e. the
"xlabel" stays at the same distance from the "xaxis". The equivalent problem
occurs with the "ylabel", i.e. I can move "ylabel" parallel to the "yaxis"
but I cannot get it any closer.
I am aware that I can "create a label" and place it anywhere by using the
text() command. Yet, it would be better if I can get the label placement
done with the xlabel/ylabel command so that I can eventually control the
label placement via rcParams.update().
Many thanks in advance.
View this message in context: http://old.nabble.com/Changing-xlabel-ylabel-position-tp31195337p31195337.html
Sent from the matplotlib - users mailing list archive at Nabble.com.