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

Skip to content

Commit 0a4b52e

Browse files
committed
Handle case where there are no ticks
1 parent 0bf73c1 commit 0a4b52e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/matplotlib/axis.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,8 +1108,14 @@ def get_tightbbox(self, renderer):
11081108
return None
11091109

11101110
def get_tick_padding(self):
1111-
return max(self.majorTicks[0].get_tick_padding(),
1112-
self.minorTicks[0].get_tick_padding())
1111+
values = []
1112+
if len(self.majorTicks):
1113+
values.append(self.majorTicks[0].get_tick_padding())
1114+
if len(self.minorTicks):
1115+
values.append(self.minorTicks[0].get_tick_padding())
1116+
if len(values):
1117+
return max(values)
1118+
return 0.0
11131119

11141120
@allow_rasterization
11151121
def draw(self, renderer, *args, **kwargs):

0 commit comments

Comments
 (0)