@@ -451,9 +451,9 @@ def prep_ticks(ax, index, ax_type, props):
451451 tick0 = tickvalues [0 ]
452452 dticks = [
453453 round (tickvalues [i ] - tickvalues [i - 1 ], 12 )
454- for i in range (1 , len (tickvalues ) - 1 )
454+ for i in range (1 , len (tickvalues ))
455455 ]
456- if all ([dticks [i ] == dticks [i - 1 ] for i in range (1 , len (dticks ) - 1 )]):
456+ if all ([dticks [i ] == dticks [i - 1 ] for i in range (1 , len (dticks ))]):
457457 dtick = tickvalues [1 ] - tickvalues [0 ]
458458 else :
459459 warnings .warn (
@@ -463,6 +463,8 @@ def prep_ticks(ax, index, ax_type, props):
463463 raise TypeError
464464 except (IndexError , TypeError ):
465465 axis_dict ["nticks" ] = props ["axes" ][index ]["nticks" ]
466+ if props ["axes" ][index ]["tickvalues" ] is not None :
467+ axis_dict ["tickvals" ] = props ["axes" ][index ]["tickvalues" ]
466468 else :
467469 axis_dict ["tick0" ] = tick0
468470 axis_dict ["dtick" ] = dtick
@@ -511,6 +513,13 @@ def prep_ticks(ax, index, ax_type, props):
511513
512514 if formatter == "LogFormatterMathtext" :
513515 axis_dict ["exponentformat" ] = "e"
516+ elif formatter == "FuncFormatter" and props ["axes" ][index ]["tickformat" ] is not None :
517+ to_remove = ["dtick" "tickmode" ]
518+ for key in to_remove :
519+ if key in axis_dict :
520+ axis_dict .pop (key )
521+ axis_dict ["ticktext" ] = props ["axes" ][index ]["tickformat" ]
522+ axis_dict ["tickvals" ] = props ["axes" ][index ]["tickvalues" ]
514523 return axis_dict
515524
516525
0 commit comments