Label baseline not aligned

Hello

I have a problem with manually set plot labels.
The baseline of the labels is not aligned when using the PDF output. It works fine for PS or PNG.
Attached is a script which demonstrates my problem.

Running
python test_baseline.py -dPDF
gives me a corrupted baseline for the x-labels.

I am using
py25-matplotlib @0.98.3_0+tkinter
installed using MacPorts.
The config file matplotlibrc is unchanged.

Thanks
Jochen

test_baseline.py (330 Bytes)

Hi,

As far as I know, xticklabels in matplotlib are "top"-aligned, so you
may see misaligned baseline sometimes. Still, the problem you reported
seems to be a bug in the pdf-backend. I posted a simple bug fix of the
pdf backend

http://article.gmane.org/gmane.comp.python.matplotlib.general/14041

and I guess this will also solve your problem. Although this fix is
not yet picked up by matplotlib developers, can you apply it by
yourself and see how it works?

Regards,

-JJ

···

On Wed, Aug 13, 2008 at 3:56 AM, Jochen Schaab <schaab@...2128...> wrote:

Hello

I have a problem with manually set plot labels.
The baseline of the labels is not aligned when using the PDF output. It
works fine for PS or PNG.
Attached is a script which demonstrates my problem.

Running
python test_baseline.py -dPDF
gives me a corrupted baseline for the x-labels.

I am using
py25-matplotlib @0.98.3_0+tkinter
installed using MacPorts.
The config file matplotlibrc is unchanged.

Thanks
Jochen

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Hi,
your fix solves my problem mostly.

Attached is my pdf output, now created with the fixed pdf-backend. The fix works, however the label "Heavy" is still a tiny little bit misaligned (you need to zoom in to see the misalignment). All other labels seem to share a common baseline now. Can you reproduce that with the script I posted earlier?

If xticklabels are "top"-aligned by default, is there an option to make them "baseline"-aligned?

Thanks for your help.

Regards
Jochen

test_baseline.pdf (82.3 KB)

···

Am 19.08.2008 um 18:44 schrieb Jae-Joon Lee:

Hi,

As far as I know, xticklabels in matplotlib are "top"-aligned, so you
may see misaligned baseline sometimes. Still, the problem you reported
seems to be a bug in the pdf-backend. I posted a simple bug fix of the
pdf backend

http://article.gmane.org/gmane.comp.python.matplotlib.general/14041

and I guess this will also solve your problem. Although this fix is
not yet picked up by matplotlib developers, can you apply it by
yourself and see how it works?

Regards,

-JJ

On Wed, Aug 13, 2008 at 3:56 AM, Jochen Schaab > <schaab@...2128...> wrote:

Hello

I have a problem with manually set plot labels.
The baseline of the labels is not aligned when using the PDF output. It
works fine for PS or PNG.
Attached is a script which demonstrates my problem.

Running
python test_baseline.py -dPDF
gives me a corrupted baseline for the x-labels.

I am using
py25-matplotlib @0.98.3_0+tkinter
installed using MacPorts.
The config file matplotlibrc is unchanged.

Thanks
Jochen

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Dipl.-Ing. Jochen Schaab

Technische Universität Darmstadt
Institute of Flight Systems and Automatic Control
Petersenstraße 30, 64287 Darmstadt, Germany

Phone: +49 (0) 6151 16-2290
Fax: +49 (0) 6151 16-5434
E-Mail: schaab@...2128...
URL: www.fsr.maschinenbau.tu-darmstadt.de

Hi Jochen,

Yes. I also can see some misalignment. I personally think that it is
very hard to get a perfect baseline alignment if you have usetex=True.
And as far as I know, if you have something like $\frac{1}{2}$ in your
string, then the baseline is not well respected.

Anyhow, The current misalignment we see seems mostly due to being
"top"-alignment. And I don't think the current matplotlib has an easy
way to adjust the alignment. The attached is a custom Axes class you
may use to get baseline-aligned xticklabels. If I use this class,
their baselines seems to align well as far as I can see. An example to
use this axes class is included in the file, and for your script, you
may add following lines before your plot() command.

from BaselineAlignedXticklabelsAxes import Subplot

ax = Subplot(h_f1, 1, 1, 1)
h_f1.add_subplot(ax)

I hope this solves your problem, but if not, I'm afraid there is
nothing I can help.

Regards,

-JJ

test_baseline.pdf (82.2 KB)

BaselineAlignedXticklabelsAxes.py (2.4 KB)

···

On Tue, Aug 19, 2008 at 1:22 PM, Jochen Schaab <schaab@...2128...> wrote:

Hi,
your fix solves my problem mostly.

Attached is my pdf output, now created with the fixed pdf-backend. The fix
works, however the label "Heavy" is still a tiny little bit misaligned (you
need to zoom in to see the misalignment). All other labels seem to share a
common baseline now. Can you reproduce that with the script I posted
earlier?

If xticklabels are "top"-aligned by default, is there an option to make them
"baseline"-aligned?

Thanks for your help.

Regards
Jochen

Am 19.08.2008 um 18:44 schrieb Jae-Joon Lee:

Hi,

As far as I know, xticklabels in matplotlib are "top"-aligned, so you
may see misaligned baseline sometimes. Still, the problem you reported
seems to be a bug in the pdf-backend. I posted a simple bug fix of the
pdf backend

http://article.gmane.org/gmane.comp.python.matplotlib.general/14041

and I guess this will also solve your problem. Although this fix is
not yet picked up by matplotlib developers, can you apply it by
yourself and see how it works?

Regards,

-JJ

On Wed, Aug 13, 2008 at 3:56 AM, Jochen Schaab >> <schaab@...2128...> wrote:

Hello

I have a problem with manually set plot labels.
The baseline of the labels is not aligned when using the PDF output. It
works fine for PS or PNG.
Attached is a script which demonstrates my problem.

Running
python test_baseline.py -dPDF
gives me a corrupted baseline for the x-labels.

I am using
py25-matplotlib @0.98.3_0+tkinter
installed using MacPorts.
The config file matplotlibrc is unchanged.

Thanks
Jochen

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Dipl.-Ing. Jochen Schaab

Technische Universität Darmstadt
Institute of Flight Systems and Automatic Control
Petersenstraße 30, 64287 Darmstadt, Germany

Phone: +49 (0) 6151 16-2290
Fax: +49 (0) 6151 16-5434
E-Mail: schaab@...2128...
URL: www.fsr.maschinenbau.tu-darmstadt.de