I think I have said this a few times, but if you're using axes_grid
toolkit, it is likely that most of the ticks, ticklabels and
axis-related command of the original matplotlib may NOT work. And that
is why I recommend you to use the spines  instead.

Anyhow, adjusting the pad between axis and the axis label in the
axes_grid toolkit way is

ax.axis["xzero"].LABELPAD=10

Things like "labelpad" parameters in xlabel (or ylabel) command are
currently ignored.

I don't think set_position command will work also. I f you need to
place your labels at some specific point, simply use "text" or
"annotate" command instead.

-JJ



On Fri, Nov 13, 2009 at 2:02 PM, per freem <perfr...@gmail.com> wrote:
> thanks for the suggestion, though this does not work for me in the
> following example:
>
> import matplotlib
> matplotlib.use('PDF')
> import matplotlib.pyplot as plt
> from matplotlib import rc
> rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
> plt.rcParams['ps.useafm'] = True
> rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
> plt.rcParams['pdf.fonttype'] = 42
> plt.rcParams['font.size'] = 10
>
> from mpl_toolkits.axes_grid.axislines import SubplotZero
>
> def setup_axes(fig, labelpad=1, invisible=["bottom", "top", "right"]):
>    plt.rcParams['ytick.major.pad'] = 2
>    plt.rcParams['ytick.minor.pad'] = 2
>    # Y ticks work, but X tick do not...
>    plt.rcParams['xtick.major.pad'] = 0.01
>    plt.rcParams['xtick.minor.pad'] = 0.01
>    ax = SubplotZero(fig, 1, 1, 1)
>    fig.add_subplot(ax)
>    # make xzero axis (horizontal axis line through y=0) visible.
>    ax.axis["xzero"].set_visible(True)
>    # make other axis (bottom, top, right) invisible.
>    for n in invisible:
>        ax.axis[n].set_visible(False)
>    return ax
>
> fig = plt.figure(figsize=(5, 5), dpi=300)
> setup_axes(fig, labelpad=2)
> x = range(1, 11)
> y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
> plt.plot(x, y, linewidth=1.5, c='k')
> plt.ylabel('hello', labelpad=10)
> xlab = plt.xlabel('hello x axis')
> xlab.set_position((0.2, 0.1))
> plt.savefig('test_logscale.pdf')
>
> the xaxis doesn't seem to be moved. any idea what might be wrong here?  
> thanks.
>
> On Fri, Nov 13, 2009 at 1:43 PM, Gökhan Sever <gokhanse...@gmail.com> wrote:
>>
>>
>> On Fri, Nov 13, 2009 at 12:36 PM, per freem <perfr...@gmail.com> wrote:
>>>
>>> hi all,
>>>
>>> how can the space between the label (e.g. thing created by
>>> plt.xlabel('mylabel')) and the axes be adjusted? i am not talking
>>> about the space between the ticklabels of the axes and the axes
>>> themselves (which is set by 'xtick.major.pad' or 'ytick.major.pad')
>>> but between the overall axes label and the axes.
>>>
>>> how can this be done?  thanks.
>>>
>>
>> Using the set_position method, e.g. :
>>
>> xlab = plt.xlabel("my x-axes label")
>> xlab.set_position((0.2, 0.1))
>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>>> 30-Day
>>> trial. Simplify your report design, integration and deployment - and focus
>>> on
>>> what you do best, core application coding. Discover what's new with
>>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>>
>> --
>> Gökhan
>>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to