Skip to content

Commit 8c2e87e

Browse files
committed
Cherry-pick PR nschloe#615: Fix for obj.get_subplotspec() being None
1 parent 1fca52d commit 8c2e87e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/tikzplotlib/_axes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,11 @@ def _colorbar(self, colorbar, data):
431431

432432
def _subplot(self, obj, data):
433433
# https://github.com/matplotlib/matplotlib/issues/7225#issuecomment-252173667
434-
geom = obj.get_subplotspec().get_topmost_subplotspec().get_geometry()
434+
try:
435+
geom = obj.get_subplotspec().get_topmost_subplotspec().get_geometry()
436+
except AttributeError:
437+
# obj.get_subplotspec() is sometimes None
438+
return
435439

436440
self.nsubplots = geom[0] * geom[1]
437441
if self.nsubplots > 1:

0 commit comments

Comments
 (0)