Skip to content

Commit

Permalink
Merge pull request #152 from mirkobunse/master
Browse files Browse the repository at this point in the history
Enable the limit_to argument from TikzPictures v3.2.0.
  • Loading branch information
mykelk committed Aug 12, 2020
2 parents 18135e6 + fa6963a commit 44ce4ad
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/PGFPlots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 == ""
Expand Down

0 comments on commit 44ce4ad

Please sign in to comment.