Merge pull request #1664 from mortenpi/fix-pyplot-savefig

Fix savefig with latexstring for pyplot
This commit is contained in:
Daniel Schwabeneder 2018-08-22 09:18:45 +02:00 committed by GitHub
commit b4944a6f81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View File

@ -387,7 +387,7 @@ end
function _initialize_backend(::PyPlotBackend)
@eval Main begin
import PyPlot, PyCall
import LaTeXStrings: latexstring
import LaTeXStrings
export PyPlot

View File

@ -236,16 +236,17 @@ function add_pyfixedformatter(cbar, vals::AVec)
cbar[:update_ticks]()
end
function labelfunc(scale::Symbol, backend::PyPlotBackend)
if scale == :log10
x -> latexstring("10^{$x}")
elseif scale == :log2
x -> latexstring("2^{$x}")
elseif scale == :ln
x -> latexstring("e^{$x}")
else
string
@require LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" begin
function labelfunc(scale::Symbol, backend::PyPlotBackend)
if scale == :log10
x -> LaTeXStrings.latexstring("10^{$x}")
elseif scale == :log2
x -> LaTeXStrings.latexstring("2^{$x}")
elseif scale == :ln
x -> LaTeXStrings.latexstring("e^{$x}")
else
string
end
end
end