mirror of https://github.com/mpastell/Weave.jl
Add `PGFPlotsX.jl` integration
parent
639f2766ea
commit
5b10a1b3b7
|
@ -30,6 +30,7 @@ julia = "1.2"
|
|||
[extras]
|
||||
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
|
||||
Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004"
|
||||
PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925"
|
||||
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
|
||||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ weave_info() = WEAVE_VERSION, string(Date(now()))
|
|||
function __init__()
|
||||
@require Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" include("integrations/Plots.jl")
|
||||
@require Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004" include("integrations/Gadfly.jl")
|
||||
@require PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925" include("integrations/PGFPlotsX.jl")
|
||||
end
|
||||
|
||||
# utilitity functions
|
||||
|
|
|
@ -32,6 +32,7 @@ const mimetype_ext = Dict(
|
|||
".pdf" => "application/pdf",
|
||||
".ps" => "application/postscript",
|
||||
".tex" => "text/latex",
|
||||
".tikz" => "text/tikz",
|
||||
)
|
||||
|
||||
function Base.display(report::Report, data)
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
module PGFPlotsXPlots
|
||||
|
||||
using ..Weave, ..PGFPlotsX
|
||||
|
||||
Base.showable(m::MIME"text/latex", plot::PGFPlotsX.AxisLike) = true
|
||||
Base.showable(m::MIME"text/tikz", plot::PGFPlotsX.AxisLike) = true
|
||||
|
||||
function Base.display(report::Weave.Report, m::MIME"text/latex", figure::PGFPlotsX.AxisLike)
|
||||
|
||||
chunk = report.cur_chunk
|
||||
|
||||
ext = chunk.options[:fig_ext]
|
||||
dpi = chunk.options[:dpi]
|
||||
|
||||
full_name, rel_name = Weave.get_figname(report, chunk, ext = ext)
|
||||
|
||||
pgfsave(full_name, figure; include_preamble = true, dpi = dpi)
|
||||
|
||||
push!(report.figures, rel_name)
|
||||
report.fignum += 1
|
||||
|
||||
return full_name
|
||||
end
|
||||
|
||||
function Base.display(report::Weave.Report, m::MIME"text/tikz", figure::PGFPlotsX.AxisLike)
|
||||
|
||||
chunk = report.cur_chunk
|
||||
|
||||
ext = chunk.options[:fig_ext]
|
||||
dpi = chunk.options[:dpi]
|
||||
|
||||
full_name, rel_name = Weave.get_figname(report, chunk, ext = ext)
|
||||
|
||||
pgfsave(full_name, figure; include_preamble = false, dpi = dpi)
|
||||
|
||||
push!(report.figures, rel_name)
|
||||
report.fignum += 1
|
||||
|
||||
return full_name
|
||||
end
|
||||
|
||||
end # PGFPlotsXPlots
|
Loading…
Reference in New Issue