ijulia, plotly, and gr display fixes

This commit is contained in:
Thomas Breloff 2016-03-08 15:07:51 -05:00
parent 9a544b0ff3
commit ed1cce86ef
3 changed files with 13 additions and 33 deletions

View File

@ -223,38 +223,16 @@ yaxis!(plt::Plot, args...; kw...) = plot!(pl
# --------------------------------------------------------- # ---------------------------------------------------------
# try
# import DataFrames
# dataframes()
# end
# const CURRENT_BACKEND = pickDefaultBackend()
# for be in backends()
# try
# backend(be)
# backend()
# catch err
# @show err
# end
# end
const CURRENT_BACKEND = CurrentBackend(:none) const CURRENT_BACKEND = CurrentBackend(:none)
# function __init__() function __init__()
# # global const CURRENT_BACKEND = pickDefaultBackend()
# # global const CURRENT_BACKEND = CurrentBackend(:none)
# # global CURRENT_BACKEND # override IJulia inline display
# # println("[Plots.jl] Default backend: ", CURRENT_BACKEND.sym) if isijulia()
@eval import IJulia
# # # auto init dataframes if the import statement doesn't error out IJulia.display_dict(plt::PlottingObject) = Dict{ASCIIString, ByteString}("text/html" => sprint(writemime, "text/html", plt))
# # try end
# # @eval import DataFrames end
# # dataframes()
# # end
# end
# --------------------------------------------------------- # ---------------------------------------------------------

View File

@ -701,6 +701,10 @@ function Base.writemime(io::IO, m::MIME"image/svg+xml", plt::PlottingObject{GRPa
write(io, readall("gks.svg")) write(io, readall("gks.svg"))
end end
function Base.writemime(io::IO, m::MIME"text/html", plt::PlottingObject{GRPackage})
writemime(io, MIME("image/svg+xml"), plt)
end
function Base.writemime(io::IO, m::MIME"application/pdf", plt::PlottingObject{GRPackage}) function Base.writemime(io::IO, m::MIME"application/pdf", plt::PlottingObject{GRPackage})
GR.emergencyclosegks() GR.emergencyclosegks()
ENV["GKS_WSTYPE"] = "pdf" ENV["GKS_WSTYPE"] = "pdf"
@ -722,5 +726,6 @@ function Base.display(::PlotsDisplay, plt::Plot{GRPackage})
end end
function Base.display(::PlotsDisplay, plt::Subplot{GRPackage}) function Base.display(::PlotsDisplay, plt::Subplot{GRPackage})
gr_display(plt)
true true
end end

View File

@ -457,11 +457,8 @@ end
# ---------------------------------------------------------------- # ----------------------------------------------------------------
function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{PlotlyPackage}) function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{PlotlyPackage})
isijulia() && return warn("todo: png")
# TODO: write a png to io
println("todo: png")
end end
function Base.writemime(io::IO, ::MIME"text/html", plt::PlottingObject{PlotlyPackage}) function Base.writemime(io::IO, ::MIME"text/html", plt::PlottingObject{PlotlyPackage})