Skip to content

MathTex Font error #5208

Closed
Closed
@tritemio

Description

@tritemio

Matplotlib 1.5.1rc1 (from conda repo)
seaborn 0.6
Anaconda
python 3.4
notebook 4.0.5
Mac OS X
backend inline

Plotting a figure with a bunch of mathtex formulas results in an error. Re-executing the same cell many times I get the error most of the time and the correct plot sometimes.

The stack trace is very long and termitates with:


/Users/anto/anaconda/envs/py3/lib/python3.4/site-packages/matplotlib/mathtext.py in __init__(self, default_font_prop, mathtext_backend)
    567 
    568         filename = findfont(default_font_prop)
--> 569         default_font = self.CachedFont(FT2Font(filename))
    570         self._fonts['default'] = default_font
    571         self._fonts['regular'] = default_font

TypeError: First argument must be a path or file object reading bytes

The plotting code is something like this:

lt, = plot(tt, res.eval(x=tt))
plot(t, Ratio, 'o', color=lt.get_color())
v = 0
for resG in resultsGauss:
    lf, = plot(tt, resG.eval(x=tt))
    plt.text(8.5, 0.7 - v, r"$\tau = %.2f s$" % resG.values['tau'], fontsize=24)
    plt.text(3, 0.7 - v, resG.model.func.__doc__, fontsize=24)
    v += 0.2
plot(t, RatioGauss, 'o', color=bpl.red)

And when it succeeds it generates a plot like this:

download

I'll update the issue if I can create a standalone example.

xref: maybe related to #3086

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions