Skip to content

Cannot index GridSpec array #149

@berceanu

Description

@berceanu

I am trying to adapt this matplotlib demo to Julia: http://matplotlib.org/users/plotting/examples/demo_gridspec03.py. I have this so far

using PyPlot
using PyCall
@pyimport matplotlib.gridspec as gspec

fig = plt.figure()

gs1 = gspec.GridSpec(1, 1)
gs1[:update](top=1.0, bottom=0.84)
ax1 = plt.subplot(gs1[0, 0])

gs2 = gspec.GridSpec(2, 1)
gs2[:update](top=0.77, bottom=0.44, hspace=0.0)
ax2 = plt.subplot(gs2[0, 0])
ax3 = plt.subplot(gs2[1, 0])

gs3 = gspec.GridSpec(2, 1)
gs3[:update](top=0.38, bottom=0.0, hspace=0.4)
ax4 = plt.subplot(gs3[0, 0])
ax5 = plt.subplot(gs3[1, 0])

fig[:savefig]("../../figures/gridspec.pdf")
plt.close(fig)

and I get
ERROR: getindex has no method matching getindex(::PyObject, ::Int64, ::Int64).
Apparently I cannot access a particular element of the grid like gs1[0,0].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions