problem with ticker and mathtext

Hello list,

the little example below seems to fail, can anybody help me?
I'm on Debian using the release 0.91.2.

best regards and thanks in advance for any hints,
Matthias

···

-------------------------------------------------------------------------------------------
from matplotlib.ticker import ScalarFormatter
from matplotlib.pyplot import *

ax = axes()
axis([0.0, 10**-7, 0, 10**-7])

ax.yaxis.set_major_formatter(ScalarFormatter(useMathText=True))

show()
------------------------------------------------------------------------------------------------
error message:
/scratch/michler/SOFT/lib/python2.4/site-packages/matplotlib/mathtext.py:722:
MathTextWarning: Unrecognized symbol '\times'. Substituting with a dummy
symbol.
  % sym.encode('ascii', 'backslashreplace'), MathTextWarning)

the string '\times' is due to line
  sciNotStr = r'{\times}'+self.format_data(10**self.orderOfMagnitude)
in function ScalarFormatter.get_offset

The default mathtext font should have the "times" symbol. Are you making any other changes that would affect the selection of mathtext fonts? (Can you please attach a copy of your matplotlibrc file?) If that looks ok, perhaps it isn't finding the math fonts correctly. There are a multitude of reasons that could be happening. It is sometimes helpful to set "verbose.level" to "debug-annoying" and then look at the logs to see what might be going on. Also, you could try deleting the fonts cache in ~/.matplotlib/fontManager.cache to force it to regenerate.

Cheers,
Mike

Matthias Michler wrote:

···

Hello list,

the little example below seems to fail, can anybody help me? I'm on Debian using the release 0.91.2.

best regards and thanks in advance for any hints,
Matthias

-------------------------------------------------------------------------------------------
from matplotlib.ticker import ScalarFormatter
from matplotlib.pyplot import *

ax = axes()
axis([0.0, 10**-7, 0, 10**-7])

ax.yaxis.set_major_formatter(ScalarFormatter(useMathText=True))

show()
------------------------------------------------------------------------------------------------
error message:
/scratch/michler/SOFT/lib/python2.4/site-packages/matplotlib/mathtext.py:722: MathTextWarning: Unrecognized symbol '\times'. Substituting with a dummy symbol. % sym.encode('ascii', 'backslashreplace'), MathTextWarning)

the string '\times' is due to line sciNotStr = r'{\times}'+self.format_data(10**self.orderOfMagnitude)
in function ScalarFormatter.get_offset

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Hello Mike, Hello list,

thanks for your reply.

The default mathtext font should have the "times" symbol. Are you
making any other changes that would affect the selection of mathtext
fonts?

I don't think that I changed anything. I only run the script attached in the
last email.

(Can you please attach a copy of your matplotlibrc file?) If
that looks ok, perhaps it isn't finding the math fonts correctly.

I attached the file.

There
are a multitude of reasons that could be happening. It is sometimes
helpful to set "verbose.level" to "debug-annoying" and then look at the
logs to see what might be going on. Also, you could try deleting the
fonts cache in ~/.matplotlib/fontManager.cache to force it to regenerate.

I deleted the ~/.matplotlib/fontManager.cache and run again my script. The
output with "verbose.level : debug-annoying" is attached, but I don't
understand what I'm doing wrong.
Maybe my matplotlibrc is to old to be used with the last improvements,
although I can't see any substantial differences.

Thanks in advance for any further suggestions.
best regards,
Matthias

program_output (6.49 KB)

matplotlibrc (11.9 KB)

···

On Wednesday 09 January 2008 17:58, Michael Droettboom wrote:

Cheers,
Mike

Matthias Michler wrote:
> Hello list,
>
> the little example below seems to fail, can anybody help me?
> I'm on Debian using the release 0.91.2.
>
> best regards and thanks in advance for any hints,
> Matthias
>
> -------------------------------------------------------------------------
>------------------ from matplotlib.ticker import ScalarFormatter
> from matplotlib.pyplot import *
>
> ax = axes()
> axis([0.0, 10**-7, 0, 10**-7])
>
> ax.yaxis.set_major_formatter(ScalarFormatter(useMathText=True))
>
> show()
> -------------------------------------------------------------------------
>----------------------- error message:
> /scratch/michler/SOFT/lib/python2.4/site-packages/matplotlib/mathtext.py:
>722: MathTextWarning: Unrecognized symbol '\times'. Substituting with a
> dummy symbol.
> % sym.encode('ascii', 'backslashreplace'), MathTextWarning)
>
>
> the string '\times' is due to line
> sciNotStr = r'{\times}'+self.format_data(10**self.orderOfMagnitude)
> in function ScalarFormatter.get_offset
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketpl
>ace _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> matplotlib-users List Signup and Options

Sorry I didn't notice this right away. This is actually a bug. I made a change so the offset (in scientific notation) is written in the same font as the other tick values, which unfortunately broke with the default fonts.

I have attached a patch against 0.91.2. This will make it into the next 0.91.x bugfix release, but that may be a while.

Cheers,
Mike

Matthias Michler wrote:

offset_labels.patch (1.23 KB)

···

Hello Mike, Hello list,

thanks for your reply.

On Wednesday 09 January 2008 17:58, Michael Droettboom wrote:

The default mathtext font should have the "times" symbol. Are you
making any other changes that would affect the selection of mathtext
fonts?

I don't think that I changed anything. I only run the script attached in the last email.

(Can you please attach a copy of your matplotlibrc file?) If that looks ok, perhaps it isn't finding the math fonts correctly.

I attached the file.

There are a multitude of reasons that could be happening. It is sometimes
helpful to set "verbose.level" to "debug-annoying" and then look at the
logs to see what might be going on. Also, you could try deleting the
fonts cache in ~/.matplotlib/fontManager.cache to force it to regenerate.

I deleted the ~/.matplotlib/fontManager.cache and run again my script. The output with "verbose.level : debug-annoying" is attached, but I don't understand what I'm doing wrong. Maybe my matplotlibrc is to old to be used with the last improvements, although I can't see any substantial differences.

Thanks in advance for any further suggestions.
best regards,
Matthias

Cheers,
Mike

Matthias Michler wrote:

Hello list,

the little example below seems to fail, can anybody help me?
I'm on Debian using the release 0.91.2.

best regards and thanks in advance for any hints,
Matthias

-------------------------------------------------------------------------
------------------ from matplotlib.ticker import ScalarFormatter
from matplotlib.pyplot import *

ax = axes()
axis([0.0, 10**-7, 0, 10**-7])

ax.yaxis.set_major_formatter(ScalarFormatter(useMathText=True))

show()
-------------------------------------------------------------------------
----------------------- error message:
/scratch/michler/SOFT/lib/python2.4/site-packages/matplotlib/mathtext.py:
722: MathTextWarning: Unrecognized symbol '\times'. Substituting with a
dummy symbol.
  % sym.encode('ascii', 'backslashreplace'), MathTextWarning)

the string '\times' is due to line
  sciNotStr = r'{\times}'+self.format_data(10**self.orderOfMagnitude)
in function ScalarFormatter.get_offset

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketpl
ace _______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

------------------------------------------------------------------------

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA