Open galenlynch opened 6 years ago
One possibility would be for getindex
to call slice
automatically when it is passed a range. Will have to wait until #629 though, since we need to first change the getindex
api so that it no longers subtracts 1 from indices automatically.
I realise this is rather old now and PyCall is vastly different, but for GridSpec in particular the method I use is just to wrap it in a py call e.g taking one of the GridSpec examples:
using PyPlot
using PyCall
fig3 = plt.figure(constrained_layout=true)
gs = fig3.add_gridspec(3, 3)
f3_ax3 = fig3.add_subplot(py"$(gs)[1:, -1]")
f3_ax3.set_title("gs[1:, -1]")
f3_ax4 = fig3.add_subplot(py"$(gs)[-1, 0]")
f3_ax4.set_title("gs[-1, 0]")
f3_ax5 = fig3.add_subplot(py"$(gs)[-1, -2]")
f3_ax5.set_title("gs[-1, -2]")
f3_ax1 = fig3.add_subplot(py"$(gs)[0, :]")
f3_ax1.set_title("gs[0, :]")
f3_ax2 = fig3.add_subplot(py"$(gs)[1, :-1]")
f3_ax2.set_title("gs[1, :-1]")
f3_ax3 = fig3.add_subplot(py"$(gs)[1:, -1]")
f3_ax3.set_title("gs[1:, -1]")
f3_ax4 = fig3.add_subplot(py"$(gs)[-1, 0]")
f3_ax4.set_title("gs[-1, 0]")
f3_ax5 = fig3.add_subplot(py"$(gs)[-1, -2]")
f3_ax5.set_title("gs[-1, -2]")
Which seems to work fine.
I'm trying to use GridSpec in matplotlib with PyCall, and ran into this error:
Is there a more straight-forward way of accomplishing this?