Text size

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Text size

Howey, David A
I'm trying to change the font size of the x and y tick numbers on some
plots but finding it a bit tricky - would appreciate some input from a
seasoned matplotlib user.

Basically, I like the way matlab sizes the text on its plots. This is
best illustrated by looking at pages 6 and 7 of the matplotlib user
guide. On page 6 is a matlab plot, and page 7, the matplotlib
equivalent. The matlab plot has nice small numbers on the axes, whereas
the matplotlib plot has quite big, chunky numbers. Is there any easy way
to permanently force matplotlib to render the axis numbering with
smaller numbers, more like the matlab example?

Thanks

Dave Howey


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

RE: Text size

Howey, David A
Can anyone help with this?
Thanks
Dave

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of
Howey, David A
Sent: 02 September 2005 12:42
To: [hidden email]
Subject: [Matplotlib-users] Text size

I'm trying to change the font size of the x and y tick numbers on some
plots but finding it a bit tricky - would appreciate some input from a
seasoned matplotlib user.

Basically, I like the way matlab sizes the text on its plots. This is
best illustrated by looking at pages 6 and 7 of the matplotlib user
guide. On page 6 is a matlab plot, and page 7, the matplotlib
equivalent. The matlab plot has nice small numbers on the axes, whereas
the matplotlib plot has quite big, chunky numbers. Is there any easy way
to permanently force matplotlib to render the axis numbering with
smaller numbers, more like the matlab example?

Thanks

Dave Howey


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices Agile & Plan-Driven Development * Managing Projects & Teams *
Testing & QA Security * Process Improvement & Measurement *
http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Text size

Darren Dale-4
On Monday 05 September 2005 8:43 am, Howey, David A wrote:
> Can anyone help with this?
> Thanks
> Dave

Try changing the text size in your matplotlibrc file.

>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Howey, David A
> Sent: 02 September 2005 12:42
> To: [hidden email]
> Subject: [Matplotlib-users] Text size
>
> I'm trying to change the font size of the x and y tick numbers on some
> plots but finding it a bit tricky - would appreciate some input from a
> seasoned matplotlib user.
>
> Basically, I like the way matlab sizes the text on its plots. This is
> best illustrated by looking at pages 6 and 7 of the matplotlib user
> guide. On page 6 is a matlab plot, and page 7, the matplotlib
> equivalent. The matlab plot has nice small numbers on the axes, whereas
> the matplotlib plot has quite big, chunky numbers. Is there any easy way
> to permanently force matplotlib to render the axis numbering with
> smaller numbers, more like the matlab example?
>
> Thanks
>
> Dave Howey

--
Darren S. Dale

Bard Hall
Department of Materials Science and Engineering
Cornell University
Ithaca, NY. 14850

[hidden email]
http://people.ccmr.cornell.edu/~dd55/


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

RE: Text size

Howey, David A
In reply to this post by Howey, David A
>> Can anyone help with this?
>> Thanks
>> Dave

>Try changing the text size in your matplotlibrc file.

In theory this should work, but although most of the properties seem to
have an effect (eg if I change from sans-serif to serif it clearly looks
different), the size property stubbornly refuses to change the size of
the text. Eg. 'large', 'small' and 'xx-small' all look the same. If you
don't believe me I can post some pictures.

Anyone else experience this? I'm using Ipython and Matplotlib on
WindowsXP.

Dave


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Text size

Darren Dale-4
On Monday 05 September 2005 10:21 am, Howey, David A wrote:

> >> Can anyone help with this?
> >> Thanks
> >> Dave
> >
> >Try changing the text size in your matplotlibrc file.
>
> In theory this should work, but although most of the properties seem to
> have an effect (eg if I change from sans-serif to serif it clearly looks
> different), the size property stubbornly refuses to change the size of
> the text. Eg. 'large', 'small' and 'xx-small' all look the same. If you
> don't believe me I can post some pictures.

You need to change tick.labelsize and axes.labelsize.

Darren


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

RE: Text size

Howey, David A
In reply to this post by Howey, David A
Brilliant! It works! Hurrah. I have to say that that is not immediately
obvious to a newbie. I would have expected the rc file setting to work.
Oh well... Thanks

Dave

-----Original Message-----

You need to change tick.labelsize and axes.labelsize.

Darren


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Text size

John Hunter-8
>>>>> "Howey," == Howey, David A <[hidden email]> writes:

    David> Brilliant! It works! Hurrah. I have to say that that is
    David> not immediately obvious to a newbie. I would have expected
    David> the rc file setting to work.  Oh well... Thanks

Well, the rc setting does work, just not the one you expected.  I
updated the rc file to read

  # note that font.size controls default text sizes.  To configure
  # special text sizes tick labels, axes, labels, title, etc, see the rc
  # settings for axes and ticks
  font.size           : medium  

Glad you got it working.

JDH


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Text size

Fernando Perez-2
In reply to this post by Darren Dale-4
Darren Dale wrote:
> On Monday 05 September 2005 10:21 am, Howey, David A wrote:

>>In theory this should work, but although most of the properties seem to
>>have an effect (eg if I change from sans-serif to serif it clearly looks
>>different), the size property stubbornly refuses to change the size of
>>the text. Eg. 'large', 'small' and 'xx-small' all look the same. If you
>>don't believe me I can post some pictures.
>
>
> You need to change tick.labelsize and axes.labelsize.

Mmh, as an outsider to the discussion, may I suggest that this sounds like a
minor API consistency or ease of use buglet?  I know that mpl has a million
knobs that can be tweaked, but in the interest of making it as
self-discoverable as possible, I'd suggest that collecting all text properties
under a unified header would make things easier.  I just had a look at the mpl
rc file, and it seems like the font size settings are done in (at least) 4
separate places:

font.size           : medium
axes.titlesize      : 14      # fontsize of the axes title
axes.labelsize      : 12      # fontsize of the x any y labels
tick.labelsize      : 12     # fontsize of the tick labels

Furthermore, one of them uses Latex-style relative settings (small, medium,
etc) and the others use fixed point sizes, while it's not clear if those three
can also take relative expressions.

This is likely to confuse a newcomer (as David's hunt revealed), and it seems
an unnecessarily complex default.  Here's an idea for a different set of settings:

font.size.default         : medium
font.size.axes_title      : auto
font.size.axes_label      : auto
font.size.tick_label      : auto

The behavior would be (suitably commented in the file):

  - font.size.default controls the default choice of font size, and all the
others are chosen as default values (hopefully good ones) relative to that.

  - If you are happy with the relative choices made by MPL, just changing
font.size.default up or down will scale all your font sizes in that direction.
  This makes it easy, for example, to quickly rebuild a plot for a talk with
larger fonts everywhere.

  - If you really want to tweak each font size setting by hand, you can do so
by specifying its value directly.  The 'auto' value will make it revert to the
mpl relative-to-font.size.default autosizing decision.

I think something like this has the dual advantages of being easier to find by
anyone on their own (all font size attributes are under font.size) and
simultaneously providing easy global tuning with full freedom for fine tweaking.

I realize that this brings the reverse problem: what if a user is tweaking
with axes properties and doesn't find the font sizes for axes there?  In the
interest of auto-discovery, shouldn't all axes (or ticks) properties live
under axes/ticks?  This is a valid concern, an inescapable problem of
hierarchical organizations whenever something can reasonably appear in more
than one place.

*nix filesystems solve this nicely with symlinks.  I don't know if that kind
of effort is really needed here, and perhaps a simple comment in the rc file
would suffice.  But if dynamic auto-discovery is desirable (via setp or
tab-completion, for example), comments in a text file won't suffice.  In that
case, perhaps the rc machinery could support something akin to symlinks, where
one could say:

axes.labelsize = link(font.size.axes_label)

and this would actually report as such at runtime.  This would allow keeping
the defaults in one place, while still letting some things appear more than
once if that makes conceptual sense.

I know this may sound to some like overkill, but if John went ahead and
implemented matplotlib GUI widgets, I dont' see why we can't also have a mpl
filesystem with symlinks!  It would certainly help as we ramp up for the alpha
release of the famed MDE (Matplotlib Desktop Environment) ;)

Just an idea...

Cheers,

f

ps - in case it wasn't clear, only the last paragraph was a joke.  The actual
linking proposal is perfectly serious, and not hard to implement.


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users