The following code reproduces the issue on v.0.5.1.:
using Plots
pyplot(tickfont = font(12, "Times New Roman"))
x = randn(1000) + 5;
# Appears correctly with Times New Roman as the font for y-ticks
plot(x)
# Appears incorrectly with the y-tick font reset to default
plot(x, yscale = :log10)
Is this behaviour desired? Is there a workaround for this?
sounds like a bug
I thought so. But is there perhaps a temporary workaround?
No I don't think so. I mean you can always open the code and try to edit it yourself, if you feel adventureous. We'll try to fix it - there also appears to be some font issues with the other backends (e.g. GR doesn't show the fonts correctly).
I've found that the LaTeX strings which are used for the log axis labels always ignore the given font.
Aha!
This seems to be a problem with matplotlib 2.0 (see https://github.com/JuliaPy/PyPlot.jl/issues/309)
In the meantime, here's a partial solution for Plots: in the definition of labelfunc(scale::Symbol, backend::PyPlotBackend), you can put escaped dollar signs around the exponent:
x -> latexstring("10\$^{$x}\$")
which stops mathtext being used for everything except the exponent itself and therefore shows the base in the correct font.
... and you can fix the mathtext too by meddling with the matplotlibrc. For example, to set the mathtext font to Helvetica, you can do:
import PyPlot
PyPlot.rc("mathtext", fontset = "custom", rm = "Helvetica",
it = "Helvetica:italic", bf = "Helvetica:bold", sf = "Helvetica")
I imagine Plots can wrap calls to PyPlot with something that will pass this information through. But I don't think you can set the appearance of mathtext differently for titles, annotations, guides or labels - so it's not as easy as just passing on the font setting from guidefont. For example, if you choose a different font for the title and then use mathtext in it, the mathtext will look out of place in the title.