File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2020,7 +2020,10 @@ def get_tick_space(self):
20202020 # There is a heuristic here that the aspect ratio of tick text
20212021 # is no more than 3:1
20222022 size = tick .label1 .get_size () * 3
2023- return int (np .floor (length / size ))
2023+ if size > 0 :
2024+ return int (np .floor (length / size ))
2025+ else :
2026+ return 2 ** 31 - 1
20242027
20252028
20262029class YAxis (Axis ):
@@ -2353,4 +2356,7 @@ def get_tick_space(self):
23532356 tick = self ._get_tick (True )
23542357 # Having a spacing of at least 2 just looks good.
23552358 size = tick .label1 .get_size () * 2.0
2356- return int (np .floor (length / size ))
2359+ if size > 0 :
2360+ return int (np .floor (length / size ))
2361+ else :
2362+ return 2 ** 31 - 1
Original file line number Diff line number Diff line change @@ -2376,6 +2376,16 @@ def test_manage_xticks():
23762376 assert_array_equal (old_xlim , new_xlim )
23772377
23782378
2379+ @cleanup
2380+ def test_tick_space_size_0 ():
2381+ # allow font size to be zero, which affects ticks when there is
2382+ # no other text in the figure.
2383+ plt .plot ([0 , 1 ], [0 , 1 ])
2384+ matplotlib .rcParams .update ({'font.size' : 0 })
2385+ b = io .BytesIO ()
2386+ plt .savefig (b , dpi = 80 , format = 'raw' )
2387+
2388+
23792389@image_comparison (baseline_images = ['errorbar_basic' , 'errorbar_mixed' ,
23802390 'errorbar_basic' ])
23812391def test_errorbar ():
You can’t perform that action at this time.
0 commit comments