added tex output; fixes for surface inputs; commented out plotly_blink
This commit is contained in:
parent
eabe670ae8
commit
55501e68fb
@ -667,9 +667,10 @@ getGadflyWriteFunc(::MIME"image/svg+xml") = Gadfly.SVG
|
|||||||
# getGadflyWriteFunc(::MIME"text/html") = Gadfly.SVGJS
|
# getGadflyWriteFunc(::MIME"text/html") = Gadfly.SVGJS
|
||||||
getGadflyWriteFunc(::MIME"application/pdf") = Gadfly.PDF
|
getGadflyWriteFunc(::MIME"application/pdf") = Gadfly.PDF
|
||||||
getGadflyWriteFunc(::MIME"application/postscript") = Gadfly.PS
|
getGadflyWriteFunc(::MIME"application/postscript") = Gadfly.PS
|
||||||
|
getGadflyWriteFunc(::MIME"application/x-tex") = Gadfly.PGF
|
||||||
getGadflyWriteFunc(m::MIME) = error("Unsupported in Gadfly/Immerse: ", m)
|
getGadflyWriteFunc(m::MIME) = error("Unsupported in Gadfly/Immerse: ", m)
|
||||||
|
|
||||||
for mime in (MIME"image/png", MIME"image/svg+xml", MIME"application/pdf", MIME"application/postscript")
|
for mime in (MIME"image/png", MIME"image/svg+xml", MIME"application/pdf", MIME"application/postscript", MIME"application/x-tex")
|
||||||
@eval function Base.writemime{P<:GadflyOrImmerse}(io::IO, ::$mime, plt::PlottingObject{P})
|
@eval function Base.writemime{P<:GadflyOrImmerse}(io::IO, ::$mime, plt::PlottingObject{P})
|
||||||
func = getGadflyWriteFunc($mime())
|
func = getGadflyWriteFunc($mime())
|
||||||
dowritemime(io, func, plt)
|
dowritemime(io, func, plt)
|
||||||
|
|||||||
@ -37,6 +37,15 @@ end
|
|||||||
ps(fn::@compat(AbstractString)) = ps(current(), fn)
|
ps(fn::@compat(AbstractString)) = ps(current(), fn)
|
||||||
|
|
||||||
|
|
||||||
|
function tex(plt::PlottingObject, fn::@compat(AbstractString))
|
||||||
|
fn = addExtension(fn, "tex")
|
||||||
|
io = open(fn, "w")
|
||||||
|
writemime(io, MIME("application/x-tex"), plt)
|
||||||
|
close(io)
|
||||||
|
end
|
||||||
|
tex(fn::@compat(AbstractString)) = tex(current(), fn)
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@ -45,6 +54,7 @@ ps(fn::@compat(AbstractString)) = ps(current(), fn)
|
|||||||
"svg" => svg,
|
"svg" => svg,
|
||||||
"pdf" => pdf,
|
"pdf" => pdf,
|
||||||
"ps" => ps,
|
"ps" => ps,
|
||||||
|
"tex" => tex,
|
||||||
)
|
)
|
||||||
|
|
||||||
function getExtension(fn::@compat(AbstractString))
|
function getExtension(fn::@compat(AbstractString))
|
||||||
|
|||||||
12
src/plot.jl
12
src/plot.jl
@ -378,14 +378,15 @@ function createKWargsList{T<:Real}(plt::PlottingObject, x::AVec, y::AVec, zmat::
|
|||||||
@assert x == sort(x)
|
@assert x == sort(x)
|
||||||
@assert y == sort(y)
|
@assert y == sort(y)
|
||||||
@assert size(zmat) == (length(x), length(y))
|
@assert size(zmat) == (length(x), length(y))
|
||||||
surf = Surface(convert(Matrix{Float64}, zmat))
|
# surf = Surface(convert(Matrix{Float64}, zmat))
|
||||||
# surf = Array(Any,1,1)
|
# surf = Array(Any,1,1)
|
||||||
# surf[1,1] = convert(Matrix{Float64}, zmat)
|
# surf[1,1] = convert(Matrix{Float64}, zmat)
|
||||||
d = Dict(kw)
|
d = Dict(kw)
|
||||||
|
d[:z] = Surface(convert(Matrix{Float64}, zmat))
|
||||||
if !(get(d, :linetype, :none) in (:contour, :surface, :wireframe))
|
if !(get(d, :linetype, :none) in (:contour, :surface, :wireframe))
|
||||||
d[:linetype] = :contour
|
d[:linetype] = :contour
|
||||||
end
|
end
|
||||||
createKWargsList(plt, x, y; d..., z = surf)
|
createKWargsList(plt, x, y; d...) #, z = surf)
|
||||||
end
|
end
|
||||||
|
|
||||||
# contours or surfaces... general x, y grid
|
# contours or surfaces... general x, y grid
|
||||||
@ -394,7 +395,12 @@ function createKWargsList{T<:Real}(plt::PlottingObject, x::AMat{T}, y::AMat{T},
|
|||||||
surf = Surface(convert(Matrix{Float64}, zmat))
|
surf = Surface(convert(Matrix{Float64}, zmat))
|
||||||
# surf = Array(Any,1,1)
|
# surf = Array(Any,1,1)
|
||||||
# surf[1,1] = convert(Matrix{Float64}, zmat)
|
# surf[1,1] = convert(Matrix{Float64}, zmat)
|
||||||
createKWargsList(plt, x, y; kw..., surface = surf, linetype = :contour)
|
d = Dict(kw)
|
||||||
|
d[:z] = Surface(convert(Matrix{Float64}, zmat))
|
||||||
|
if !(get(d, :linetype, :none) in (:contour, :surface, :wireframe))
|
||||||
|
d[:linetype] = :contour
|
||||||
|
end
|
||||||
|
createKWargsList(plt, Any[x], Any[y]; d...) #kw..., z = surf, linetype = :contour)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -235,11 +235,11 @@ function backend()
|
|||||||
# end borrowing (thanks :)
|
# end borrowing (thanks :)
|
||||||
###########################
|
###########################
|
||||||
|
|
||||||
try
|
# try
|
||||||
include(joinpath(Pkg.dir("Plots"), "src", "backends", "plotly_blink.jl"))
|
# include(joinpath(Pkg.dir("Plots"), "src", "backends", "plotly_blink.jl"))
|
||||||
catch err
|
# catch err
|
||||||
warn("Error including Plotlyjs: $err\n Note: Will fall back to built-in display.")
|
# warn("Error including Plotlyjs: $err\n Note: Will fall back to built-in display.")
|
||||||
end
|
# end
|
||||||
|
|
||||||
end
|
end
|
||||||
catch err
|
catch err
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user