general matplotlib usage questions

Hi,

I think matplotlib is a terrific tool, and it is a major component of
the open source toolset that has allowed me to stop using Matlab.

But, whenever it comes to producing publication plots, there are a few
things I always find challenging - and I'm wondering if I'm doing
things wrong.

First, what backend do people recommend for use on OS X? At the moment
I am using TkAgg. But is there any backend that will behave as a
proper OS X application ie allow window switching with cmd-`, maybe
allow use of the maximise button etc.?

When producing publication size plots - ie 3x3 in or smaller (that
usually appear very small in the interactive window) there is an
annoying behaviour where any mouse over the graph seems to resize it -
the plot jumps around in size as I move the mouse over it. This is
mainly annoying because it means when producing a batch of plots for
later use, I have to be very careful not to mouse over, since once I
do that, I can no longer be sure it will return to the same size, so
the final set of images would have different sizes. If I accidently
mouse over I have to go back and recreate the plot. Is this a property
of the backend I am using?

Again, when working with small sizes, the procedure for chaning the
size of the figure is quite involved. As well as the standard problem
of making sure the text fits, nothing overlaps the image etc.
matplotlib doesn't seem to position the axes correctly in the figure -
the labels are usually cut off. So I have to manually experiment with
ax.set_position() by trial and error until I find a solution that
looks OK - but of course if I later change the size of the figure I
have to repeat this procedure. Is there an easier way to do this?

Thanks,

Robin

Hi,

I think matplotlib is a terrific tool, and it is a major component of

the open source toolset that has allowed me to stop using Matlab.

But, whenever it comes to producing publication plots, there are a few

things I always find challenging - and I’m wondering if I’m doing

things wrong.

First, what backend do people recommend for use on OS X? At the moment

I am using TkAgg. But is there any backend that will behave as a

proper OS X application ie allow window switching with cmd-`, maybe

allow use of the maximise button etc.?

When producing publication size plots - ie 3x3 in or smaller (that

usually appear very small in the interactive window) there is an

annoying behaviour where any mouse over the graph seems to resize it -

the plot jumps around in size as I move the mouse over it. This is

mainly annoying because it means when producing a batch of plots for

later use, I have to be very careful not to mouse over, since once I

do that, I can no longer be sure it will return to the same size, so

the final set of images would have different sizes. If I accidently

mouse over I have to go back and recreate the plot. Is this a property

of the backend I am using?

I think I know what causes this, I saw something similar in the Qt backends a while back. When the mouse cursor enters the axes, the coordinates of the cursor are reported in the statusbar/toolbar. The backend needs to be configured so this text widget would rather run off the end of the window than resize the window. I don’t know how this is done in Tk, I’ve never worked with that GUI library.

Again, when working with small sizes, the procedure for chaning the

size of the figure is quite involved. As well as the standard problem

of making sure the text fits, nothing overlaps the image etc.

matplotlib doesn’t seem to position the axes correctly in the figure -

the labels are usually cut off. So I have to manually experiment with

ax.set_position() by trial and error until I find a solution that

looks OK - but of course if I later change the size of the figure I

have to repeat this procedure. Is there an easier way to do this?

You can use the subplot_adjust button on the toolbar for some degree of customization. But in general, it can be a somewhat time consuming to get the layout just right. I think it would be difficult for mpl to determine what the appropriate axes position should be given a certain figure and text size.

Darren

···

On Thursday 20 November 2008 06:43:48 am Robin wrote:

There is a recipe on the web site for automatically shifting the left
side of the subplot over to make room for the ylabels

  http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels

It might be nice to make an option to handle the simple case
automatically, to expand or shrink the subplots so the text fits w/o
too much padding on any side.

JDH

···

On Thu, Nov 20, 2008 at 7:12 AM, Darren Dale <darren.dale@...163...> wrote:

You can use the subplot_adjust button on the toolbar for some degree of
customization. But in general, it can be a somewhat time consuming to get
the layout just right. I think it would be difficult for mpl to determine
what the appropriate axes position should be given a certain figure and text
size.

That's great - is there anything similar for axis labels (I haven't
been using long tick labels - the problem I have is normal x and y
axis labels are cut off) - or will that example also work?

Thanks,

Robin

···

On Thu, Nov 20, 2008 at 1:21 PM, John Hunter <jdh2358@...287...> wrote:

There is a recipe on the web site for automatically shifting the left
side of the subplot over to make room for the ylabels

http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels

Dear ALL,

In due time, I intend to compile as many suggestions and tips as
possible to eventually create a "How-To" list for the superb Basemap
module, like the very useful one which is on the Matplotlib home page.

HTH

Cheers,

2008/11/20 John Hunter <jdh2358@...287...>:

···

On Thu, Nov 20, 2008 at 7:12 AM, Darren Dale <darren.dale@...163...> wrote:

You can use the subplot_adjust button on the toolbar for some degree of
customization. But in general, it can be a somewhat time consuming to get
the layout just right. I think it would be difficult for mpl to determine
what the appropriate axes position should be given a certain figure and text
size.

There is a recipe on the web site for automatically shifting the left
side of the subplot over to make room for the ylabels

http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels

It might be nice to make an option to handle the simple case
automatically, to expand or shrink the subplots so the text fits w/o
too much padding on any side.

JDH

-------------------------------------------------------------------------
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
matplotlib-users List Signup and Options

--
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: maurobio@...287...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."