Merge pull request #1838 from tkf/smuggle
Smuggle PyCall and LaTeXStrings through PyPlot
This commit is contained in:
commit
3bfedd844e
@ -526,8 +526,7 @@ const _plotlyjs_scale = _plotly_scale
|
|||||||
|
|
||||||
function _initialize_backend(::PyPlotBackend)
|
function _initialize_backend(::PyPlotBackend)
|
||||||
@eval Main begin
|
@eval Main begin
|
||||||
import PyPlot, PyCall
|
import PyPlot
|
||||||
import LaTeXStrings
|
|
||||||
|
|
||||||
export PyPlot
|
export PyPlot
|
||||||
|
|
||||||
@ -539,11 +538,8 @@ end
|
|||||||
function add_backend_string(::PyPlotBackend)
|
function add_backend_string(::PyPlotBackend)
|
||||||
"""
|
"""
|
||||||
using Pkg
|
using Pkg
|
||||||
Pkg.add("PyPlot")
|
|
||||||
Pkg.add("PyCall")
|
|
||||||
Pkg.add("LaTeXStrings")
|
|
||||||
withenv("PYTHON" => "") do
|
withenv("PYTHON" => "") do
|
||||||
Pkg.build("PyCall")
|
Pkg.add("PyPlot")
|
||||||
Pkg.build("PyPlot")
|
Pkg.build("PyPlot")
|
||||||
end
|
end
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
# Do "using PyPlot: PyCall, LaTeXStrings" without dependency warning:
|
||||||
|
const PyCall = PyPlot.PyCall
|
||||||
|
const LaTeXStrings = PyPlot.LaTeXStrings
|
||||||
|
|
||||||
# https://github.com/stevengj/PyPlot.jl
|
# https://github.com/stevengj/PyPlot.jl
|
||||||
|
|
||||||
@ -187,26 +190,22 @@ function add_pyfixedformatter(cbar, vals::AVec)
|
|||||||
cbar[:update_ticks]()
|
cbar[:update_ticks]()
|
||||||
end
|
end
|
||||||
|
|
||||||
@require LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" begin
|
function labelfunc(scale::Symbol, backend::PyPlotBackend)
|
||||||
function labelfunc(scale::Symbol, backend::PyPlotBackend)
|
if scale == :log10
|
||||||
if scale == :log10
|
x -> LaTeXStrings.latexstring("10^{$x}")
|
||||||
x -> LaTeXStrings.latexstring("10^{$x}")
|
elseif scale == :log2
|
||||||
elseif scale == :log2
|
x -> LaTeXStrings.latexstring("2^{$x}")
|
||||||
x -> LaTeXStrings.latexstring("2^{$x}")
|
elseif scale == :ln
|
||||||
elseif scale == :ln
|
x -> LaTeXStrings.latexstring("e^{$x}")
|
||||||
x -> LaTeXStrings.latexstring("e^{$x}")
|
else
|
||||||
else
|
string
|
||||||
string
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@require PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0" begin
|
function py_mask_nans(z)
|
||||||
function py_mask_nans(z)
|
# pynp["ma"][:masked_invalid](z)))
|
||||||
# pynp["ma"][:masked_invalid](z)))
|
PyCall.pycall(pynp["ma"][:masked_invalid], Any, z)
|
||||||
PyCall.pycall(pynp["ma"][:masked_invalid], Any, z)
|
# pynp["ma"][:masked_where](pynp["isnan"](z),z)
|
||||||
# pynp["ma"][:masked_where](pynp["isnan"](z),z)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user