semilog, exponents, and eps

Hi, I am reporting a minor bug. I noticed that if I change

    > the ticklabel size to 10, draw a semilogy plot, and save
    > an eps file, that the yticklabels in the eps are badly
    > formatted. The exponent runs into the base.

    > from matplotlib import * rc('tick',labelsize=10) from
    > pylab import *

    > semilogy([1,2,3],[1e-5,1,1e5]) savefig('temp.eps')

The relevant section of code is matplotlib.text.Text._get_layout_super

        wb,hb = renderer.get_text_width_height(base, self._fontproperties, False)
        we,he = renderer.get_text_width_height(exponent, fpexp, False)

        w = wb+we

        xb, yb = self._transform.xy_tup((self._x, self._y))
        xe = xb+wb
        ye = yb+0.5*hb
        h = ye+he-yb

w,h is width and height and e,b is exponent and base -- eg, xb is the
x location of the base and wb is the width of the base. Try adding a
pad to xe, eg

   xe = xb+1.05*wb

and see if you can find something that works well for a variety of
reasonable font sizes. You might want to make the pad dependent on
the fontsize...

JDH

    > Hi, I am reporting a minor bug. I noticed that if I change
    > the ticklabel size to 10, draw a semilogy plot, and save
    > an eps file, that the yticklabels in the eps are badly
    > formatted. The exponent runs into the base.

[...]

The relevant section of code is matplotlib.text.Text._get_layout_super

[...]

see if you can find something that works well for a variety of
reasonable font sizes. You might want to make the pad dependent on
the fontsize...

The following conditions will work for eps files, however, the labels in the
plot on the screen are adversely effected.

        if size<12: xe = xb+1.3*wb
        elif size==16: xe = xb+1.175*wb
        else: xe = xb+1.125*wb
        ye = yb+0.5*hb

Is it possible that the translation to postscript is what needs to be
modified?

Darren

···

On Tuesday 22 February 2005 01:47 pm, John Hunter wrote: