From fa6963a52121d8ba325f0635414839346d7ec176 Mon Sep 17 00:00:00 2001 From: Mirko Bunse Date: Wed, 12 Aug 2020 14:17:56 +0200 Subject: [PATCH] Enable the limit_to argument from TikzPictures v3.2.0. Older versions of TikzPictures are still supported; the new argument is only delegated if it is actually specified by the user. --- src/PGFPlots.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/PGFPlots.jl b/src/PGFPlots.jl index 59634f1..b57c1bc 100644 --- a/src/PGFPlots.jl +++ b/src/PGFPlots.jl @@ -891,7 +891,7 @@ function Base.show(f::IO, a::MIME"image/svg+xml", p::Plottable) end end -function save(filename::AbstractString, o::Plottable; include_preamble::Bool=true) +function save(filename::AbstractString, o::Plottable; include_preamble::Bool=true, limit_to::Symbol=:default) _, ext = splitext(filename) ext = lowercase(ext) if ext == ".pdf" @@ -901,7 +901,12 @@ function save(filename::AbstractString, o::Plottable; include_preamble::Bool=tru save(SVG(filename), plot(o)) cleanup(o) elseif ext == ".tex" - save(TEX(filename, include_preamble=include_preamble), plot(o)) + # limit_to requires TikzPictures v3.2.0; only use if specified + if limit_to != :default + save(TEX(filename; limit_to=limit_to), plot(o)) + else + save(TEX(filename, include_preamble=include_preamble), plot(o)) + end elseif ext == ".tikz" save(TIKZ(filename), plot(o)) elseif ext == "." || ext == ""