Compare commits
4 Commits
master
...
as/more_wi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61b5568e5e | ||
|
|
d337c4edae | ||
|
|
8db2de64d5 | ||
|
|
67a2a0f8d7 |
@ -781,13 +781,12 @@ function gr_axis_width(sp, axis)
|
||||
end
|
||||
|
||||
function _update_min_padding!(sp::Subplot{GRBackend})
|
||||
has_user_gkswstype = haskey(ENV, "GKSwstype")
|
||||
withenv("GKSwstype" => 100, "GKS_ENCODING" => "utf8") do
|
||||
dpi = sp.plt[:thickness_scaling]
|
||||
ENV["GKS_ENCODING"] = "utf8"
|
||||
if !haskey(ENV, "GKSwstype")
|
||||
if isijulia()
|
||||
if has_user_gkswstype && isijulia()
|
||||
ENV["GKSwstype"] = "svg"
|
||||
end
|
||||
end
|
||||
# Add margin given by the user
|
||||
leftpad = 2mm + sp[:left_margin]
|
||||
toppad = 2mm + sp[:top_margin]
|
||||
@ -936,6 +935,7 @@ function _update_min_padding!(sp::Subplot{GRBackend})
|
||||
rightpad += 4mm
|
||||
end
|
||||
sp.minpad = Tuple(dpi * [leftpad, toppad, rightpad, bottompad])
|
||||
end # end withenv
|
||||
end
|
||||
|
||||
function is_equally_spaced(v)
|
||||
@ -1938,20 +1938,17 @@ for (mime, fmt) in (
|
||||
"image/svg+xml" => "svg",
|
||||
)
|
||||
@eval function _show(io::IO, ::MIME{Symbol($mime)}, plt::Plot{GRBackend})
|
||||
ENV["GKS_ENCODING"] = "utf8"
|
||||
GR.emergencyclosegks()
|
||||
filepath = tempname() * "." * $fmt
|
||||
env = get(ENV, "GKSwstype", "0")
|
||||
ENV["GKSwstype"] = $fmt
|
||||
ENV["GKS_FILEPATH"] = filepath
|
||||
withenv(
|
||||
"GKS_ENCODING" => "utf8",
|
||||
"GKSwstype" => $fmt,
|
||||
"GKS_FILEPATH" => filepath
|
||||
) do
|
||||
gr_display(plt, $fmt)
|
||||
GR.emergencyclosegks()
|
||||
write(io, read(filepath, String))
|
||||
rm(filepath)
|
||||
if env != "0"
|
||||
ENV["GKSwstype"] = env
|
||||
else
|
||||
pop!(ENV, "GKSwstype")
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1961,17 +1958,18 @@ function _display(plt::Plot{GRBackend})
|
||||
if plt[:display_type] == :inline
|
||||
GR.emergencyclosegks()
|
||||
filepath = tempname() * ".pdf"
|
||||
ENV["GKSwstype"] = "pdf"
|
||||
ENV["GKS_FILEPATH"] = filepath
|
||||
withenv("GKSwstype" => "pdf", "GKS_FILEPATH" => filepath) do
|
||||
gr_display(plt)
|
||||
GR.emergencyclosegks()
|
||||
content = string("\033]1337;File=inline=1;preserveAspectRatio=0:", base64encode(open(read, filepath)), "\a")
|
||||
println(content)
|
||||
rm(filepath)
|
||||
end
|
||||
else
|
||||
ENV["GKS_DOUBLE_BUF"] = true
|
||||
withenv("GKS_DOUBLE_BUF" => true) do
|
||||
gr_display(plt)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
closeall(::GRBackend) = GR.emergencyclosegks()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user