0

I have a grid defined as 'g' of 2 rows and 2 columns, used 'GridSpec' function.

Then I have to create an axes, using plt.subplot function. The subplot must span the 1st row and 1st column of the defined grid 'g'.

My question is - subplot must span the 1st row and 1st column of the defined grid, where as I am defining g[0,:1] - How does this be used in grids? Basically by this slicing, how I am going to calculate grids. If someone can elaborate on this ..will appreciate in advance..Thanks

My code :-

g = gridspec.GridSpec(2,2)
axes1 = plt.subplot(g[0,:1],title='Custom Title')
P K M
  • 51
  • 6
  • have a look at [understanding python's slice notation](https://stackoverflow.com/q/509211/13138364) – tdy Jul 02 '21 at 07:15
  • note that `g[0,:1]` just ends up being `g[0,0]` – tdy Jul 02 '21 at 07:16
  • thanks ...but my question was more specific to grid then slicing. Slicing, I am aware of, how grids are calculated..will update the question . – P K M Jul 03 '21 at 14:31

0 Answers0