What version of matplotlib are you using? With the current svn, your code works okay.
-JJ On Fri, Nov 13, 2009 at 10:37 AM, per freem <perfr...@gmail.com> wrote: > hi all, > > i am trying to adjust the space (padding) between the tickmarks on an > axes and the labels. usually, i can do this by setting > 'xtick.major.pad' and 'xtick.minor.pad' (and same for y-axis) in > rcParams. however, when i try to do this with a figure made using the > "SubplotZero" function, it seems to only work for the y-axis and not > the x-axis for some reason -- here is an 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) > ax = plt.gca() > plt.savefig('test.pdf') > > i am seeing the ylabels get closer to the y-axis, but the x-axis seems > to have no effect. it seems to be related to SubplotZero since > otherwise in ordinary plots this works fine. any idea how this could > be fixed? > > thanks very much for your help. > > ------------------------------------------------------------------------------ > 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