Strange behaviour of ytitle()

Hi all, I find ytitle() to behave quite strangely ; the

    > first link points to a figure to each left subplot of
    > which I used

    > ylabel(labl)

    > and on the figure pointed by the second link I used

    > text(-0.07,0.5,labl,verticalalignment='center',
    > rotation='vertical',transform=gca().transAxes,clip_on=False)

    > http://nicolasgirard.nerim.net/ytitle.jpg
    > http://nicolasgirard.nerim.net/text.jpg

    > from these 2 samples it seems like ytitle()'s behaviour
    > is odd, or at least not optimal. What do you think ?

Which backend are you using? It could be a backend specific bug. From
the fact that you are making jpg images, my guess is you are using GTK
or WX. Unless you have good reason not to, I would advise you to use
GTKAgg/WXAgg and output PNG. PNG is a much better format for line art
and text.

Do you see the extra horizontal space in *Agg or PS backends? Note
also that the space between the yticklabels and the ylabel is
controlled by ax.yaxis.LABELPAD, which defaults to 5 points. Also,
are you using mathtext or rc.usetex=True?

When reporting problems, it is very helpful to

  1) run your script with --verbose-helpful and report the output

  2) indicated any nondefault rc options (rc.usetex?)

  3) attach a standalone script we can run, if possible

This will save me a lot of guessing and typing.

Thanks!
JDH

    > Hi all, I find ytitle() to behave quite strangely ; the
    > first link points to a figure to each left subplot of
    > which I used

    > ylabel(labl)

    > and on the figure pointed by the second link I used

    > text(-0.07,0.5,labl,verticalalignment='center',
    > rotation='vertical',transform=gca().transAxes,clip_on=False)

    > http://nicolasgirard.nerim.net/ytitle.jpg
    > http://nicolasgirard.nerim.net/text.jpg

    > from these 2 samples it seems like ytitle()'s behaviour
    > is odd, or at least not optimal. What do you think ?

Sorry for the late answer.

Which backend are you using? It could be a backend specific bug.

I tried with the standard one (Agg ?), then I saved the plot as ps, png and
jpeg ; and the result was the same

From
the fact that you are making jpg images, my guess is you are using GTK
or WX.

Actually my concern was to produce files with reasonable size so that you can
download them more quickly

Unless you have good reason not to, I would advise you to use
GTKAgg/WXAgg and output PNG. PNG is a much better format for line art
and text.

You must be right ; And the nice thing I've just discovered is that the png
files are lighter than the jpeg ones... fine !

Do you see the extra horizontal space in *Agg or PS backends?

Yes

Note
also that the space between the yticklabels and the ylabel is
controlled by ax.yaxis.LABELPAD, which defaults to 5 points.

The extra space is less problematic than the misalignment of the labels, in
fact. As they get properly aligned with the text() function, I guess there's
room for improvement without too much effort (at least I hope so)

Also,
are you using mathtext or rc.usetex=True?

Yes, I have added "rc.usetex=True" to my config file

When reporting problems, it is very helpful to

  1) run your script with --verbose-helpful and report the output

Okay, here you are:

python t.py --verbose-helpful
matplotlib data path /usr/share/matplotlib
loaded rc file /home/ngirard/.matplotlibrc
matplotlib version 0.81
verbose.level helpful
interactive is False
platform is linux2
numerix Numeric 23.1
font search path ['/usr/share/matplotlib']
loaded ttfcache file /home/ngirard/.ttffont.cache
backend GTKAgg version 2.6.2

  2) indicated any nondefault rc options (rc.usetex?)

Please find attached my config file.

  3) attach a standalone script we can run, if possible

I've attached the script, but I'm afraid you can't run it, as it reads a huge
data file I cannot send to you...

There's an other annoying bug with this script. For the subplots on columns 2
and 3 I asked the yaxis to have only but 3 ticks, using:

  majorLocator = LinearLocator(numticks=3)

  ...
  a=subplot(nbvals,3,i)
  a.yaxis.set_major_locator(majorLocator)

which works, but as the figure gets refreshed, the ticks disappear, and at the
end only part of them remain visible. I've encounetered this with the
standard Agg backend, with either interactive and non-interactive mode.
Saving as jpeg, png and ps didn't help, as you can see here:

http://nicolasgirard.nerim.net/out.png

Cheers,
Nicolas

.matplotlibrc (9.09 KB)

t.py (2.7 KB)

···

On Wednesday 08 June 2005 17:12, John Hunter wrote:

Unfortunately, this problem remains, even after updating my sandbox and trying
Baptiste Carvello's patch :-/

cheers,
nicolas

···

On Friday 10 June 2005 00:13, Nicolas Girard wrote:

There's an other annoying bug with this script. For the subplots on columns
2 and 3 I asked the yaxis to have only but 3 ticks, using:

  majorLocator = LinearLocator(numticks=3)

  ...
  a=subplot(nbvals,3,i)
  a.yaxis.set_major_locator(majorLocator)

which works, but as the figure gets refreshed, the ticks disappear, and at
the end only part of them remain visible. I've encounetered this with the
standard Agg backend, with either interactive and non-interactive mode.
Saving as jpeg, png and ps didn't help, as you can see here:

http://nicolasgirard.nerim.net/out.png