@@ -2366,7 +2366,7 @@ def _matplotlib_tick_formatter(self, subplot, base=(10, 10),
2366
2366
elif x_locator == []:
2367
2367
x_locator = NullLocator ()
2368
2368
elif isinstance (x_locator , list ):
2369
- x_locator = FixedLocator (x_locator )
2369
+ x_locator = FixedLocator ([ float ( x ) for x in x_locator ] )
2370
2370
else : # x_locator is a number which can be made a float
2371
2371
from sage .functions .other import ceil , floor
2372
2372
if floor (xmax / x_locator ) - ceil (xmin / x_locator ) > 1 :
@@ -2387,7 +2387,7 @@ def _matplotlib_tick_formatter(self, subplot, base=(10, 10),
2387
2387
elif y_locator == []:
2388
2388
y_locator = NullLocator ()
2389
2389
elif isinstance (y_locator , list ):
2390
- y_locator = FixedLocator (y_locator )
2390
+ y_locator = FixedLocator ([ float ( y ) for y in y_locator ] )
2391
2391
else : # y_locator is a number which can be made a float
2392
2392
from sage .functions .other import ceil , floor
2393
2393
if floor (ymax / y_locator ) - ceil (ymin / y_locator ) > 1 :
@@ -2419,7 +2419,11 @@ def _matplotlib_tick_formatter(self, subplot, base=(10, 10),
2419
2419
LogFormatterMathtext (base = base [0 ])(n , pos ).replace (
2420
2420
"\\ mathdefault" , "" ))
2421
2421
else :
2422
- x_formatter = FuncFormatter (lambda n , pos : '$%s$' % latex (n ))
2422
+ # circumvent the problem of symbolic tick values (trac #34693)
2423
+ if isinstance (x_locator , FixedLocator ):
2424
+ x_formatter = FixedFormatter (['$%s$' % latex (n ) for n in ticks [0 ]])
2425
+ else :
2426
+ x_formatter = FuncFormatter (lambda n , pos : '$%s$' % latex (n ))
2423
2427
elif isinstance (x_formatter , (list , tuple )):
2424
2428
if (not isinstance (ticks [0 ], (list , tuple )) or
2425
2429
len (ticks [0 ]) != len (x_formatter )):
@@ -2444,7 +2448,11 @@ def _matplotlib_tick_formatter(self, subplot, base=(10, 10),
2444
2448
LogFormatterMathtext (base = base [1 ])(n , pos ).replace (
2445
2449
"\\ mathdefault" , "" ))
2446
2450
else :
2447
- y_formatter = FuncFormatter (lambda n , pos : '$%s$' % latex (n ))
2451
+ # circumvent the problem of symbolic tick values (trac #34693)
2452
+ if isinstance (y_locator , FixedLocator ):
2453
+ y_formatter = FixedFormatter (['$%s$' % latex (n ) for n in ticks [1 ]])
2454
+ else :
2455
+ y_formatter = FuncFormatter (lambda n , pos : '$%s$' % latex (n ))
2448
2456
elif isinstance (y_formatter , (list , tuple )):
2449
2457
if (not isinstance (ticks [1 ], (list , tuple )) or
2450
2458
len (ticks [1 ]) != len (y_formatter )):
0 commit comments