Skip to content

Commit 2e7fc7e

Browse files
committed
Fix pythonplot in notebooks: return gcf() from reveal
1 parent 2d85c4d commit 2e7fc7e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/pycommon.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ function initialize!(p, ::Type{T}) where {T <: AbstractPythonPlotterType}
77
p.context[:figure] = PyPlotter.figure(p.context[:fignumber]; dpi = 50, figsize = res ./ 50)
88
else
99
p.context[:figure] = PyPlotter.figure(p.context[:fignumber]; dpi = 100, figsize = res ./ 100)
10+
p.context[:figure].set_size_inches(res[1] / 100, res[2] / 100, forward = true)
1011
end
11-
#p.context[:figure].set_size_inches(res[1] / 100, res[2] / 100, forward = true)
1212
for ctx in p.subplots
1313
ctx[:figure] = p.context[:figure]
1414
end
@@ -36,15 +36,16 @@ function reveal(p::GridVisualizer, ::Type{T}) where {T <: AbstractPythonPlotterT
3636
p.Plotter.draw()
3737
sleep(1.0e-3)
3838
end
39-
return p.context[:figure]
39+
return p.Plotter.gcf()
4040
end
4141

4242
function reveal(ctx::SubVisualizer, TP::Type{T}) where {T <: AbstractPythonPlotterType}
4343
yield()
4444
if ctx[:show] || ctx[:reveal]
4545
reveal(ctx[:GridVisualizer], TP)
4646
end
47-
return ctx[:GridVisualizer].Plotter.tight_layout()
47+
ctx[:GridVisualizer].Plotter.tight_layout()
48+
return ctx[:GridVisualizer].Plotter.gcf()
4849
end
4950

5051
#translate Julia attribute symbols to pyplot-speak

0 commit comments

Comments
 (0)