pgfplots display popup
This commit is contained in:
parent
514284e784
commit
d7098f77c2
@ -55,10 +55,10 @@ subplotSupported(::PGFPlotsBackend) = false
|
|||||||
|
|
||||||
|
|
||||||
function _initialize_backend(::PGFPlotsBackend; kw...)
|
function _initialize_backend(::PGFPlotsBackend; kw...)
|
||||||
@eval begin
|
@eval begin
|
||||||
import PGFPlots
|
import PGFPlots
|
||||||
export PGFPlots
|
export PGFPlots
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -295,25 +295,39 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function _writemime(io::IO, mime::MIME"image/svg+xml", plt::Plot{PGFPlotsBackend})
|
function _writemime(io::IO, mime::MIME"image/svg+xml", plt::Plot{PGFPlotsBackend})
|
||||||
_make_pgf_plot!(plt)
|
_make_pgf_plot!(plt)
|
||||||
writemime(io, mime, plt.o)
|
writemime(io, mime, plt.o)
|
||||||
end
|
end
|
||||||
|
|
||||||
function _writemime(io::IO, mime::MIME"application/pdf", plt::Plot{PGFPlotsBackend})
|
function _writemime(io::IO, mime::MIME"application/pdf", plt::Plot{PGFPlotsBackend})
|
||||||
_make_pgf_plot!(plt)
|
_make_pgf_plot!(plt)
|
||||||
|
|
||||||
# prepare the object
|
# prepare the object
|
||||||
pgfplt = PGFPlots.plot(plt.o)
|
pgfplt = PGFPlots.plot(plt.o)
|
||||||
|
|
||||||
# save a pdf
|
# save a pdf
|
||||||
fn = tempname()*".pdf"
|
fn = tempname()*".pdf"
|
||||||
PGFPlots.save(PGFPlots.PDF(fn), pgfplt)
|
PGFPlots.save(PGFPlots.PDF(fn), pgfplt)
|
||||||
|
|
||||||
# read it into io
|
# read it into io
|
||||||
write(io, readall(open(fn)))
|
write(io, readall(open(fn)))
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
PGFPlots.cleanup(plt.o)
|
||||||
end
|
end
|
||||||
|
|
||||||
function _display(plt::Plot{PGFPlotsBackend})
|
function _display(plt::Plot{PGFPlotsBackend})
|
||||||
_make_pgf_plot!(plt)
|
# prepare the object
|
||||||
display(plt.o)
|
_make_pgf_plot!(plt)
|
||||||
|
pgfplt = PGFPlots.plot(plt.o)
|
||||||
|
|
||||||
|
# save an svg
|
||||||
|
fn = string(tempname(), ".svg")
|
||||||
|
PGFPlots.save(PGFPlots.SVG(fn), pgfplt)
|
||||||
|
|
||||||
|
# show it
|
||||||
|
open_browser_window(fn)
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
PGFPlots.cleanup(plt.o)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user