introducing mpl_toolkits.gridspec


Jae-Joon Lee <lee.j.joon@...83...> writes:

gridspec is a module that implements matplotlib’s Subplot slightly
differently. Current matplotlib’s Subplot only allows a Subplot to
occupy a single cell of the n x m grid. gridspec enables a Subplot to
occupy multiple cells.

Very interesting indeed. If I may comment on the usability, I wish function
gridspec.subplot could become directly a method of Gridspec. The current example:

gs = gridspec.GridSpec(3, 3)
ax1 = gridspec.subplot(gs[0, :])
ax2 = gridspec.subplot(gs[1,:-1])
ax3 = gridspec.subplot(gs[1:, -1])
ax4 = gridspec.subplot(gs[-1,0])
ax5 = gridspec.subplot(gs[-1,-2])

could be written in a much simpler way then, such as:

gs = gridspec.GridSpec(3, 3)
ax1 = gs[0, :]
ax2 = gs[1,:-1]
ax3 = gs[1:, -1]
ax4 = gs[-1,0]
ax5 = gs[-1,-2]

I would LOVE it!

+1 for getting these functionnalities straight in matplotlib: subplot management
always take a decent part of my scripts...


I'm inclined to leave the GridSpec as it is and I prefer to have a
separate class for this (if we go for it). My inclination is to modify
subplot2grid to return such an instance. e.g.,

grid = gridspec.subplot2grid((2,2))
ax1 = grid[0,:]




On Wed, May 12, 2010 at 5:58 AM, Yannick Copin <yannick.copin@...547...> wrote:

gs = gridspec.GridSpec(3, 3)
ax1 = gs[0, :]