diff --git a/src/backends/gadfly.jl b/src/backends/gadfly.jl index 441c1b7e..ee6beb43 100644 --- a/src/backends/gadfly.jl +++ b/src/backends/gadfly.jl @@ -667,9 +667,10 @@ getGadflyWriteFunc(::MIME"image/svg+xml") = Gadfly.SVG # getGadflyWriteFunc(::MIME"text/html") = Gadfly.SVGJS getGadflyWriteFunc(::MIME"application/pdf") = Gadfly.PDF getGadflyWriteFunc(::MIME"application/postscript") = Gadfly.PS +getGadflyWriteFunc(::MIME"application/x-tex") = Gadfly.PGF 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}) func = getGadflyWriteFunc($mime()) dowritemime(io, func, plt) diff --git a/src/output.jl b/src/output.jl index afc98c25..5a97848a 100644 --- a/src/output.jl +++ b/src/output.jl @@ -37,6 +37,15 @@ end 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, "pdf" => pdf, "ps" => ps, + "tex" => tex, ) function getExtension(fn::@compat(AbstractString)) diff --git a/src/plot.jl b/src/plot.jl index 47b11a43..db7a8c02 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -378,14 +378,15 @@ function createKWargsList{T<:Real}(plt::PlottingObject, x::AVec, y::AVec, zmat:: @assert x == sort(x) @assert y == sort(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[1,1] = convert(Matrix{Float64}, zmat) 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, x, y; d..., z = surf) + createKWargsList(plt, x, y; d...) #, z = surf) end # 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 = Array(Any,1,1) # 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 diff --git a/src/plotter.jl b/src/plotter.jl index 1963acfb..6d84da53 100644 --- a/src/plotter.jl +++ b/src/plotter.jl @@ -235,11 +235,11 @@ function backend() # end borrowing (thanks :) ########################### - try - include(joinpath(Pkg.dir("Plots"), "src", "backends", "plotly_blink.jl")) - catch err - warn("Error including Plotlyjs: $err\n Note: Will fall back to built-in display.") - end + # try + # include(joinpath(Pkg.dir("Plots"), "src", "backends", "plotly_blink.jl")) + # catch err + # warn("Error including Plotlyjs: $err\n Note: Will fall back to built-in display.") + # end end catch err