xtick formatting

I have a question about tick formatting. I have a semilogx

    > plot and if I resize the xticks using locs , labels = xticks
    > () set(labels , size=ticksize) I like the size and the font,
    > but the exponents (10^0) run into the axis.

The reasons for are complicated and have to do with an optimization to
make exponential ticking faster, and I won't go into them right now.
Suffice it to say that it is a bug, but there may be a workaround

Do any of the suggestions here help?

  http://matplotlib.sourceforge.net/faq.html#TEXTOVERLAP

Note you can also control the "pad" in points of the offset of the
ticks from the xaxis

  ticks = ax.xaxis.get_major_ticks()
  for tick in ticks:
      tick.set_pad(6)

or if you prefer

  set(ax.xaxis.get_major_ticks(), pad=6)

The default pad is controlled by an rc parameter

  tick.major.pad : 4 # distance to major tick label in points
  tick.minor.pad : 4 # distance to the minor tick label in points

See http://matplotlib.sf.net/.matplotlibrc

JDH

Setting the pad in the .matplotlibrc file was an excellent solution for me. And being able to set all my font preferences there is a great feature that I don't think Matlab has. One of the first things I needed to do in Matlab was write a script that formatted my figures the way I liked. I assumed I needed to do the same thing in mpl, but not so. Good Stuff!

Ryan

John Hunter wrote:

···

"Ryan" == Ryan Krauss <ryanfedora@...614...> writes:
           
   > I have a question about tick formatting. I have a semilogx
   > plot and if I resize the xticks using locs , labels = xticks
   > () set(labels , size=ticksize) I like the size and the font,
   > but the exponents (10^0) run into the axis.

The reasons for are complicated and have to do with an optimization to
make exponential ticking faster, and I won't go into them right now.
Suffice it to say that it is a bug, but there may be a workaround

Do any of the suggestions here help?

http://matplotlib.sourceforge.net/faq.html#TEXTOVERLAP

Note you can also control the "pad" in points of the offset of the
ticks from the xaxis

ticks = ax.xaxis.get_major_ticks()
for tick in ticks:
     tick.set_pad(6)

or if you prefer

set(ax.xaxis.get_major_ticks(), pad=6)

The default pad is controlled by an rc parameter

tick.major.pad : 4 # distance to major tick label in points
tick.minor.pad : 4 # distance to the minor tick label in points

See http://matplotlib.sf.net/.matplotlibrc

JDH