From e0f0abd6a1d258a33ae9ace88d43357ab8fbcd03 Mon Sep 17 00:00:00 2001 From: Zhanibek Date: Thu, 18 Jul 2024 16:27:14 +0900 Subject: [PATCH] fixup --- PlotsBase/src/arg_desc.jl | 2 +- PlotsBase/src/output.jl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PlotsBase/src/arg_desc.jl b/PlotsBase/src/arg_desc.jl index d83fa3d45..1599be5fe 100644 --- a/PlotsBase/src/arg_desc.jl +++ b/PlotsBase/src/arg_desc.jl @@ -83,7 +83,7 @@ const _arg_desc = KW( Example: `pgfplotsx(); scatter(1:5, extra_kwargs=Dict(:subplot=>Dict("axis line shift" => "10pt"))`."""), :fontfamily => (Union{AStr,Symbol}, "Default font family for title, legend entries, tick labels and guides."), :warn_on_unsupported => (Bool, "Warn on unsupported attributes, series types and marker shapes."), - :safe_saving => (Bool, "Do not override existing files when saving to disk. Choose from (true, false)"), + :safe_saving => (Bool, "Do not override existing files when saving to disk. Choose from (true, false), i.e. `plot(rand(10), safe_saving=false)` for enable file overriding"), # subplot args :title => (AStr, "Subplot title."), diff --git a/PlotsBase/src/output.jl b/PlotsBase/src/output.jl index df21e2610..90ba74c80 100644 --- a/PlotsBase/src/output.jl +++ b/PlotsBase/src/output.jl @@ -138,8 +138,8 @@ file types, some also support svg, ps, eps, html and tex. """ function savefig(plt::Plot, fn) # fn might be an `AbstractString` or an `AbstractPath` from `FilePaths.jl` fn = abspath(expanduser(fn)) - if isfile(fn) - @warn "Filename $fn already exist, defaulting to omit overriding. To disable this behavior, provide `:safe_saving=false` kwarg." + if isfile(fn) && plt[:safe_saving] + @warn "Filename $fn already exists, defaulting to prevent overriding. To disable this behavior, provide `:safe_saving=false` kwarg, i.e. `plot(rand(10), safe_saving=false)`" return end # get the extension