faster plotIndex count; withenv logic and cairox11/cairopng in gr
This commit is contained in:
parent
755a70bf77
commit
fe1b759787
@ -1144,7 +1144,13 @@ function _add_defaults!(d::KW, plt::Plot, sp::Subplot, commandIndex::Int)
|
|||||||
|
|
||||||
# this is how many series belong to this subplot
|
# this is how many series belong to this subplot
|
||||||
# plotIndex = count(series -> series.d[:subplot] === sp && series.d[:primary], plt.series_list)
|
# plotIndex = count(series -> series.d[:subplot] === sp && series.d[:primary], plt.series_list)
|
||||||
plotIndex = count(series -> series[:primary], sp.series_list)
|
plotIndex = 0
|
||||||
|
for series in sp.series_list
|
||||||
|
if series[:primary]
|
||||||
|
plotIndex += 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# plotIndex = count(series -> series[:primary], sp.series_list)
|
||||||
if get(d, :primary, true)
|
if get(d, :primary, true)
|
||||||
plotIndex += 1
|
plotIndex += 1
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1021,14 +1021,13 @@ const _gr_mimeformats = Dict(
|
|||||||
for (mime, fmt) in _gr_mimeformats
|
for (mime, fmt) in _gr_mimeformats
|
||||||
@eval function _show(io::IO, ::MIME{Symbol($mime)}, plt::Plot{GRBackend})
|
@eval function _show(io::IO, ::MIME{Symbol($mime)}, plt::Plot{GRBackend})
|
||||||
GR.emergencyclosegks()
|
GR.emergencyclosegks()
|
||||||
wstype = haskey(ENV, "GKS_WSTYPE") ? ENV["GKS_WSTYPE"] : "0"
|
|
||||||
filepath = tempname() * "." * $fmt
|
filepath = tempname() * "." * $fmt
|
||||||
ENV["GKS_WSTYPE"] = $fmt
|
withenv("GKS_WSTYPE" => $fmt == "png" ? "cairopng" : $fmt,
|
||||||
ENV["GKS_FILEPATH"] = filepath
|
"GKS_FILEPATH" => filepath) do
|
||||||
gr_display(plt)
|
gr_display(plt)
|
||||||
GR.emergencyclosegks()
|
GR.emergencyclosegks()
|
||||||
|
end
|
||||||
write(io, readstring(filepath))
|
write(io, readstring(filepath))
|
||||||
ENV["GKS_WSTYPE"] = wstype
|
|
||||||
rm(filepath)
|
rm(filepath)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1037,15 +1036,18 @@ function _display(plt::Plot{GRBackend})
|
|||||||
if plt[:display_type] == :inline
|
if plt[:display_type] == :inline
|
||||||
GR.emergencyclosegks()
|
GR.emergencyclosegks()
|
||||||
filepath = tempname() * ".pdf"
|
filepath = tempname() * ".pdf"
|
||||||
ENV["GKS_WSTYPE"] = "pdf"
|
withenv("GKS_WSTYPE" => "pdf",
|
||||||
ENV["GKS_FILEPATH"] = filepath
|
"GKS_FILEPATH" => filepath) do
|
||||||
gr_display(plt)
|
gr_display(plt)
|
||||||
GR.emergencyclosegks()
|
GR.emergencyclosegks()
|
||||||
|
end
|
||||||
content = string("\033]1337;File=inline=1;preserveAspectRatio=0:", base64encode(open(readbytes, filepath)), "\a")
|
content = string("\033]1337;File=inline=1;preserveAspectRatio=0:", base64encode(open(readbytes, filepath)), "\a")
|
||||||
println(content)
|
println(content)
|
||||||
rm(filepath)
|
rm(filepath)
|
||||||
else
|
else
|
||||||
ENV["GKS_DOUBLE_BUF"] = "true"
|
withenv("GKS_WSTYPE" => get(ENV, "GKS_WSTYPE", "cairox11"),
|
||||||
gr_display(plt)
|
"GKS_DOUBLE_BUF" => get(ENV ,"GKS_DOUBLE_BUF", "true")) do
|
||||||
|
gr_display(plt)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user