Skip to content

\times in minor ticklabels not recognized due to \mathdefault #10029

@jmd-dk

Description

@jmd-dk

Bug report

Bug summary
The '\times' glyph in minor ticklabels of log plots is not being recognized because it is getting wrapped inside '\mathdefault{...}'. The problem and a temporary solution (simply removing '\mathdefault') is fully described on Stack Overflow.

Code for reproduction

import matplotlib
import matplotlib.pyplot as plt

# Customize matplotlib
matplotlib.rcParams.update({# Use mathtext, not LaTeX
                            'text.usetex': False,
                            # Use the Computer modern font
                            'font.family': 'serif',
                            'font.serif': 'cmr10',
                            'mathtext.fontset': 'cm',
                            # Use ASCII minus
                            'axes.unicode_minus': False,
                            })

# Plot
plt.semilogy([-0.03, 0.05], [0.3, 0.05])
plt.savefig('test.png')

Actual outcome

python/lib/python3.6/site-packages/matplotlib/mathtext.py:866: MathTextWarning: Font 'default' does not have a glyph for '\times' [U+d7]
  MathTextWarning)
python/lib/python3.6/site-packages/matplotlib/mathtext.py:867: MathTextWarning: Substituting with a dummy symbol.
  warn("Substituting with a dummy symbol.", MathTextWarning)

Actual test.png

Expected outcome
Expected test.png
This is only a problem with matplotlib 2.x, as 1.x never automatically places minor ticklabels.

Matplotlib version

  • Operating system: Linux
  • Matplotlib version: 2.0.2, but the bug is consistently reproduced in all of matplotlib 2.x
  • Matplotlib backend: Agg, TkAgg
  • Python version: 3.6

I have installed Python and matplotlib from source.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions