File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 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):
20212021 # There is a heuristic here that the aspect ratio of tick text
20222022 # is no more than 3:1
20232023 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
20252028
20262029
20272030class YAxis (Axis ):
@@ -2354,4 +2357,7 @@ def get_tick_space(self):
23542357 tick = self ._get_tick (True )
23552358 # Having a spacing of at least 2 just looks good.
23562359 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():
23012301 assert_array_equal (old_xlim , new_xlim )
23022302
23032303
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+
23042314@image_comparison (baseline_images = ['errorbar_basic' , 'errorbar_mixed' ,
23052315 'errorbar_basic' ])
23062316def test_errorbar ():
You can’t perform that action at this time.
0 commit comments