On Fri, Nov 13, 2009 at 1: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
>
You are hiding the bottom x-axis. Therefore no label is appearing on the
resulting figure. You may try not hiding it instead just the ticks. Using
ax.xaxis.set_major_locator(pylab.NullLocator())
But this causes the vertical grid lines to disappear. Alternatively you can
manually add the xlabel if you are not in batch-producing mode --using your
favorite pdf editor.
I am sure Jae-Jeon has a better explanation for this.
>
> 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
> >
>
--
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