Global font size

Matplot folks,
Is there a way to increase all font sizes globally across the board?
I played around with some RC parameters but they don't seem to have
any effect.

I found that I could more or less achieve the desired result by the
following steps:
1) plot to something like subplot(6,6,1). That is, make a 6x6 plot
grid but only use the upper left subplot of it.
With that the text is large relative to the plot, but spacing is not good, so...
2) Make plot window really large so text isn't overlapping so much
3) Save result to svg
4) in Inkscape or other svg editor cut out the big unused region, and
fix badly positioned labels (e.g. text too far left in legend box).

That basically worked, but it's quite hacky.

I think it's pretty obvious why this would be useful, but if not, my
particular use case is that I want to make some graphs that will be
very small in the final document, so the text needs to be at about 9pt
in an overall bounding box of approx. 3cm x 2cm.

This question was asked once before in 2006 but apparently got no answer:
http://sourceforge.net/mailarchive/message.php?msg_name=1137144577.12809.4.camel%40inpc93.et.tudelft.nl

Thanks for any hints!
--bb

Hi Bill,

Matplot folks,
Is there a way to increase all font sizes globally across the board?
I played around with some RC parameters but they don't seem to have
any effect.

Here's a note from the default matplotlibrc:

# 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. Special text sizes can be defined
# relative to font.size, using the following values: xx-small, x-small,
# small, medium, large, x-large, xx-large, larger, or smaller
#font.size : 12.0

You set that size, and then set a relative size (like "medium") for your other
settings. I should include this in the new docs, if it is not covered
already.

Darren

···

On Thursday 19 June 2008 8:18:12 pm Bill Baxter wrote:

According to the docs the rc function is supposed to be able to do the
same thing as editing matplotlibrc.
I tried doing
  rc('font', size=20)
and several variations of that invoked at several different places in
my file, and it seemed to have no effect.

Did I do it wrong? Does rc() not really work as advertised?
Something completely different?

For what it's worth my matplotlib.pylab.__version__ is '1.1.0'

--bb

···

On Fri, Jun 20, 2008 at 10:01 AM, Darren Dale <dsdale24@...287...> wrote:

Hi Bill,

On Thursday 19 June 2008 8:18:12 pm Bill Baxter wrote:

Matplot folks,
Is there a way to increase all font sizes globally across the board?
I played around with some RC parameters but they don't seem to have
any effect.

Here's a note from the default matplotlibrc:

# 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. Special text sizes can be defined
# relative to font.size, using the following values: xx-small, x-small,
# small, medium, large, x-large, xx-large, larger, or smaller
#font.size : 12.0

You set that size, and then set a relative size (like "medium") for your other
settings. I should include this in the new docs, if it is not covered
already.

> Hi Bill,
>
>> Matplot folks,
>> Is there a way to increase all font sizes globally across the board?
>> I played around with some RC parameters but they don't seem to have
>> any effect.
>
> Here's a note from the default matplotlibrc:
>
> # 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. Special text sizes can be defined
> # relative to font.size, using the following values: xx-small, x-small,
> # small, medium, large, x-large, xx-large, larger, or smaller
> #font.size : 12.0
>
> You set that size, and then set a relative size (like "medium") for your
> other settings. I should include this in the new docs, if it is not
> covered already.

According to the docs the rc function is supposed to be able to do the
same thing as editing matplotlibrc.
I tried doing
  rc('font', size=20)
and several variations of that invoked at several different places in
my file, and it seemed to have no effect.

Did I do it wrong? Does rc() not really work as advertised?
Something completely different?

I think in this case, you need to change those settings before importing
pylab:

import matplotlib
matplotlib.rcParams['font.size'] = 12
import pylab

or better yet, do it with a matplotlibrc file

For what it's worth my matplotlib.pylab.__version__ is '1.1.0'

Really? That looks like numpy's version, not matplotlib's.

Darren

···

On Thursday 19 June 2008 9:13:15 pm Bill Baxter wrote:

On Fri, Jun 20, 2008 at 10:01 AM, Darren Dale <dsdale24@...287...> wrote:
> On Thursday 19 June 2008 8:18:12 pm Bill Baxter wrote:

Thanks for the reply.

> Hi Bill,
>
>> Matplot folks,
>> Is there a way to increase all font sizes globally across the board?
>> I played around with some RC parameters but they don't seem to have
>> any effect.
>
> Here's a note from the default matplotlibrc:
>
> # 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. Special text sizes can be defined
> # relative to font.size, using the following values: xx-small, x-small,
> # small, medium, large, x-large, xx-large, larger, or smaller
> #font.size : 12.0
>
> You set that size, and then set a relative size (like "medium") for your
> other settings. I should include this in the new docs, if it is not
> covered already.

According to the docs the rc function is supposed to be able to do the
same thing as editing matplotlibrc.
I tried doing
  rc('font', size=20)
and several variations of that invoked at several different places in
my file, and it seemed to have no effect.

Did I do it wrong? Does rc() not really work as advertised?
Something completely different?

I think in this case, you need to change those settings before importing
pylab:

import matplotlib
matplotlib.rcParams['font.size'] = 12
import pylab

I see. I usually just do it in one shot like:
  from matplotlib import pylab as plot

or better yet, do it with a matplotlibrc file

For what it's worth my matplotlib.pylab.__version__ is '1.1.0'

Really? That looks like numpy's version, not matplotlib's.

I guess it's just namespace weirdness then. Using the import
incantation I gave above, plot.__version__ reports 1.1.0.
matplotlib.__version__ gives '0.98.0'.

I tried putting this in my matplotlibrc but it seems to have no effect:

    font.size : 30.0

Just to make sure things were actually working I also tried this:

   font.weight : bold

That one worked, all text on the plot turned bold. That suggests to
me that the global font size setting probably just has a bug at the
moment.

--bb

···

On Fri, Jun 20, 2008 at 10:32 AM, Darren Dale <dsdale24@...287...> wrote:

On Thursday 19 June 2008 9:13:15 pm Bill Baxter wrote:

On Fri, Jun 20, 2008 at 10:01 AM, Darren Dale <dsdale24@...287...> wrote:
> On Thursday 19 June 2008 8:18:12 pm Bill Baxter wrote:

Bill Baxter wrote:

Thanks for the reply.

Hi Bill,

Matplot folks,
Is there a way to increase all font sizes globally across the board?
I played around with some RC parameters but they don't seem to have
any effect.

Here's a note from the default matplotlibrc:

# 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. Special text sizes can be defined
# relative to font.size, using the following values: xx-small, x-small,
# small, medium, large, x-large, xx-large, larger, or smaller
#font.size : 12.0

You set that size, and then set a relative size (like "medium") for your
other settings. I should include this in the new docs, if it is not
covered already.

According to the docs the rc function is supposed to be able to do the
same thing as editing matplotlibrc.
I tried doing
  rc('font', size=20)
and several variations of that invoked at several different places in
my file, and it seemed to have no effect.

Did I do it wrong? Does rc() not really work as advertised?
Something completely different?

I think in this case, you need to change those settings before importing
pylab:

import matplotlib
matplotlib.rcParams['font.size'] = 12
import pylab

I see. I usually just do it in one shot like:
  from matplotlib import pylab as plot

or better yet, do it with a matplotlibrc file

For what it's worth my matplotlib.pylab.__version__ is '1.1.0'

Really? That looks like numpy's version, not matplotlib's.

I guess it's just namespace weirdness then. Using the import
incantation I gave above, plot.__version__ reports 1.1.0.
matplotlib.__version__ gives '0.98.0'.

I tried putting this in my matplotlibrc but it seems to have no effect:

    font.size : 30.0

Just to make sure things were actually working I also tried this:

   font.weight : bold

That one worked, all text on the plot turned bold. That suggests to
me that the global font size setting probably just has a bug at the
moment.

I see one slightly obscure bug that is not the cause of this problem.

The big problem appears to be that although the mechanism is in place for all this nice global control, it is not being *used* by default. That is, the default sizes for axis labels and such are all given in points, not using the strings "medium" etc. As a workaround you could make a matplotlibrc file with the strings substituted for all the font sizes in points that you can find; but it looks like this is something we really need to fix.

Eric

···

On Fri, Jun 20, 2008 at 10:32 AM, Darren Dale <dsdale24@...287...> wrote:

On Thursday 19 June 2008 9:13:15 pm Bill Baxter wrote:

On Fri, Jun 20, 2008 at 10:01 AM, Darren Dale <dsdale24@...287...> wrote:

On Thursday 19 June 2008 8:18:12 pm Bill Baxter wrote:

--bb

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Eric Firing wrote:

Bill Baxter wrote:

I tried putting this in my matplotlibrc but it seems to have no effect:

    font.size : 30.0

Just to make sure things were actually working I also tried this:

   font.weight : bold

That one worked, all text on the plot turned bold. That suggests to
me that the global font size setting probably just has a bug at the
moment.

I see one slightly obscure bug that is not the cause of this problem.

Fixed in the branch and trunk.

The big problem appears to be that although the mechanism is in place for all this nice global control, it is not being *used* by default. That is, the default sizes for axis labels and such are all given in points, not using the strings "medium" etc. As a workaround you could make a matplotlibrc file with the strings substituted for all the font sizes in points that you can find; but it looks like this is something we really need to fix.

Fixed in the trunk--please check it.

Eric