Skip to content

Latex Font Not Adjusted #309

@cortner

Description

@cortner

The following code

using PyPlot, LaTeXStrings, PyCall
PyPlot.rc("font", family="serif", size=14)
fig = plot(rand(10))
xlabel(L"latex: $r [ \AA ]$")

produces a plot where all fonts are serif except the Latex text remains sans-serif.

This fixes it somewhat

using PyPlot, LaTeXStrings, PyCall
PyPlot.rc("font", family="serif", size=14)
rcParams = PyDict(PyPlot.matplotlib["rcParams"])
rcParams["text.usetex"] = true
fig = plot(rand(10))
xlabel(L"latex: $r [ \AA ]$")

but I think the font is still not consistent (though maybe one needs to fix the "serif" choice?)

Either way, this seems to be an issue since matplotlib 2.0; probably these issues are related:

I am not entirely sure what the default behaviour ought to be but the current behaviour certainly seems wrong. Maybe this will be fixed in a matplotlib update, so creating a work-around now might not be worthwhile, but I couldn't tell from those issues whether this was actually the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions