Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bcc9ead

Browse files
committed
BUG: Fixes issue matplotlib#966. When appending the new axes, there is a bug where it
does not account for the reference horizontal locator index when adding a veritcal axes and does not accout for the reference vertical locator index when adding a horizontal axes. This fixes that bug so that the append_axes function adds the axes where it is expected.
1 parent 76f902c commit bcc9ead

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/mpl_toolkits/axes_grid1/axes_divider.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,10 @@ def new_horizontal(self, size, pad=None, pack_start=False, **kwargs):
554554
if pack_start:
555555
self._horizontal.insert(0, size)
556556
self._xrefindex += 1
557-
locator = self.new_locator(nx=0, ny=0)
557+
locator = self.new_locator(nx=0, ny=self._yrefindex)
558558
else:
559559
self._horizontal.append(size)
560-
locator = self.new_locator(nx=len(self._horizontal)-1, ny=0)
560+
locator = self.new_locator(nx=len(self._horizontal)-1, ny=self._yrefindex)
561561

562562
ax = self._get_new_axes(**kwargs)
563563
ax.set_axes_locator(locator)
@@ -601,10 +601,10 @@ def new_vertical(self, size, pad=None, pack_start=False, **kwargs):
601601
if pack_start:
602602
self._vertical.insert(0, size)
603603
self._yrefindex += 1
604-
locator = self.new_locator(nx=0, ny=0)
604+
locator = self.new_locator(nx=self._xrefindex, ny=0)
605605
else:
606606
self._vertical.append(size)
607-
locator = self.new_locator(nx=0, ny=len(self._vertical)-1)
607+
locator = self.new_locator(nx=self._xrefindex, ny=len(self._vertical)-1)
608608

609609
ax = self._get_new_axes(**kwargs)
610610
ax.set_axes_locator(locator)

0 commit comments

Comments
 (0)