Skip to content

Commit

Permalink
Set figure size via fig.set_size_inches. This works on the screen
Browse files Browse the repository at this point in the history
and in Pluto notebooks, removing the necessity to close the figure first.
  • Loading branch information
j-fu committed May 10, 2021
1 parent 20dcbe1 commit c7b8dbf
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/pyplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ function initialize!(p, ::Type{PyPlotType})
PyPlot.PyObject(PyPlot.axes3D)# see https://github.com/JuliaPy/PyPlot.jl/issues/351
if !haskey(p.context,:figure)
res=p.context[:resolution]
p.context[:figure]=PyPlot.figure(p.context[:fignumber])
if isdefined(Main, :PlutoRunner) # Reset figure for Pluto
PyPlot.close(p.context[:figure])
end
p.context[:figure]=PyPlot.figure(p.context[:fignumber],figsize=(res[1]/100,res[2]/100),dpi=100)
p.context[:figure]=PyPlot.figure(p.context[:fignumber],dpi=100)
p.context[:figure].set_size_inches(res[1]/100,res[2]/100,forward=true)
for ctx in p.subplots
ctx[:figure]=p.context[:figure]
end
Expand Down

0 comments on commit c7b8dbf

Please sign in to comment.