# PyPlot warning

**URL:** <https://discourse.julialang.org/t/pyplot-warning/32553>\
**Category:** Visualization\
**Tags:** pyplot\
**Created:** [December 21, 2019, 12:48pm UTC](https://discourse.julialang.org/t/pyplot-warning/32553 "2019-12-21T12:48:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zwwi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zwwi/32/11932_2.png) [@zwwi](https://discourse.julialang.org/u/zwwi)\
**Post date:** [December 21, 2019, 12:48pm UTC](https://discourse.julialang.org/t/pyplot-warning/32553/1 "2019-12-21T12:48:43Z")

</div>

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

```julia

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)

fig.add_subplot(spec[1,1])

```

Then I got the following warning:

```julia
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.

---

<div class="post-metadata">

**Author:** ![danielc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielc/32/220_2.png) [@danielc](https://discourse.julialang.org/u/danielc)\
**Post date:** [September 24, 2020, 5:37pm UTC](https://discourse.julialang.org/t/pyplot-warning/32553/2 "2020-09-24T17:37:31Z")

</div>

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.
