PyPlot warning

I am using PyPlot to make a plot with subplots of different sizes.

using PyPlot

fig=figure(constrained_layout=false, figsize=(5, 4))
heights = [1, 2]
spec = fig.add_gridspec(ncols=1, nrows=2, height_ratios=heights, hspace=0.0)


Then I got the following warning:

Warning: `getindex(o::PyObject, i1::Integer, i2::Integer)` is deprecated, use `get(o, (i1 - 1, i2 - 1))` instead.

How should I add subplot with the specified specs to avoid the warning? Thanks in advance.


This response is 9 months late, but since I just hit the same problem I would like to post a solution for future readers.

If you replace spec[1,1] with get(spec,(0,0)) you should get the correct object without the warnings. In general, replace spec[i1,i2] with get(spec,(i1-1,i2-1)). Notice the change from Julia 0-based indexing to Python 1-based indexing.