File tree 2 files changed +18
-2
lines changed 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -2021,7 +2021,10 @@ def get_tick_space(self):
2021
2021
# There is a heuristic here that the aspect ratio of tick text
2022
2022
# is no more than 3:1
2023
2023
size = tick .label1 .get_size () * 3
2024
- return int (np .floor (length / size ))
2024
+ if size > 0 :
2025
+ return int (np .floor (length / size ))
2026
+ else :
2027
+ return 2 ** 31 - 1
2025
2028
2026
2029
2027
2030
class YAxis (Axis ):
@@ -2354,4 +2357,7 @@ def get_tick_space(self):
2354
2357
tick = self ._get_tick (True )
2355
2358
# Having a spacing of at least 2 just looks good.
2356
2359
size = tick .label1 .get_size () * 2.0
2357
- return int (np .floor (length / size ))
2360
+ if size > 0 :
2361
+ return int (np .floor (length / size ))
2362
+ else :
2363
+ return 2 ** 31 - 1
Original file line number Diff line number Diff line change @@ -2301,6 +2301,16 @@ def test_manage_xticks():
2301
2301
assert_array_equal (old_xlim , new_xlim )
2302
2302
2303
2303
2304
+ @cleanup
2305
+ def test_tick_space_size_0 ():
2306
+ # allow font size to be zero, which affects ticks when there is
2307
+ # no other text in the figure.
2308
+ plt .plot ([0 , 1 ], [0 , 1 ])
2309
+ matplotlib .rcParams .update ({'font.size' : 0 })
2310
+ b = io .BytesIO ()
2311
+ plt .savefig (b , dpi = 80 , format = 'raw' )
2312
+
2313
+
2304
2314
@image_comparison (baseline_images = ['errorbar_basic' , 'errorbar_mixed' ,
2305
2315
'errorbar_basic' ])
2306
2316
def test_errorbar ():
You can’t perform that action at this time.
0 commit comments