Merge pull request #3727 from t-bltg/debug_mplot

Gaston: debug mplot
This commit is contained in:
t-bltg 2021-07-29 18:42:06 +02:00 committed by GitHub
commit 434656def6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -47,7 +47,7 @@ jobs:
PYTHON: "" PYTHON: ""
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
run: | run: |
# export JULIA_DEBUG=Documenter export JULIA_DEBUG=Documenter
export PLOTDOCS_ANSICOLOR=true export PLOTDOCS_ANSICOLOR=true
export GKSwstype=nul # Plots.jl/issues/3664 export GKSwstype=nul # Plots.jl/issues/3664
xvfb-run julia --color=yes --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.add(PackageSpec(name="Plots", rev=split(ENV["GITHUB_REF"], "/", limit=3)[3])); Pkg.instantiate()' xvfb-run julia --color=yes --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.add(PackageSpec(name="Plots", rev=split(ENV["GITHUB_REF"], "/", limit=3)[3])); Pkg.instantiate()'

View File

@ -12,7 +12,7 @@ const GNUPLOT_DPI = 72 # Compensate for DPI with increased resolution
# Create the window/figure for this backend. # Create the window/figure for this backend.
function _create_backend_figure(plt::Plot{GastonBackend}) function _create_backend_figure(plt::Plot{GastonBackend})
xsize, ysize = plt.attr[:size] xsize, ysize = plt.attr[:size]
G.set(termopts="""size $xsize,$ysize""") # G.set(termopts="size $xsize,$ysize")
state_handle = G.nexthandle() # for now all the figures will be kept state_handle = G.nexthandle() # for now all the figures will be kept
plt.o = G.newfigure(state_handle) plt.o = G.newfigure(state_handle)
@ -89,14 +89,14 @@ function _show(io::IO, mime::MIME{Symbol("image/png")}, plt::Plot{GastonBackend}
xsize, ysize = plt.attr[:size] .* scaling xsize, ysize = plt.attr[:size] .* scaling
# Scale all plot elements to match Plots.jl DPI standard # Scale all plot elements to match Plots.jl DPI standard
termopts = """size $xsize,$ysize fontscale $scaling lw $scaling dl $scaling ps $scaling""" termopts = "size $xsize,$ysize fontscale $scaling lw $scaling dl $scaling ps $scaling"
tmpfile = G.tempname() tmpfile = G.tempname()
G.save( G.save(
term="pngcairo", term="pngcairo",
output=tmpfile, output=tmpfile,
handle=plt.o.handle, handle=plt.o.handle,
saveopts=termopts # saveopts=termopts
) )
while !isfile(tmpfile) end # avoid race condition with read in next line while !isfile(tmpfile) end # avoid race condition with read in next line
write(io, read(tmpfile)) write(io, read(tmpfile))