@@ -452,9 +452,9 @@ def prep_ticks(ax, index, ax_type, props):
452452 tick0 = tickvalues [0 ]
453453 dticks = [
454454 round (tickvalues [i ] - tickvalues [i - 1 ], 12 )
455- for i in range (1 , len (tickvalues ) - 1 )
455+ for i in range (1 , len (tickvalues ))
456456 ]
457- if all ([dticks [i ] == dticks [i - 1 ] for i in range (1 , len (dticks ) - 1 )]):
457+ if all ([dticks [i ] == dticks [i - 1 ] for i in range (1 , len (dticks ))]):
458458 dtick = tickvalues [1 ] - tickvalues [0 ]
459459 else :
460460 warnings .warn (
@@ -464,6 +464,8 @@ def prep_ticks(ax, index, ax_type, props):
464464 raise TypeError
465465 except (IndexError , TypeError ):
466466 axis_dict ["nticks" ] = props ["axes" ][index ]["nticks" ]
467+ if props ["axes" ][index ]["tickvalues" ] is not None :
468+ axis_dict ["tickvals" ] = props ["axes" ][index ]["tickvalues" ]
467469 else :
468470 axis_dict ["tick0" ] = tick0
469471 axis_dict ["dtick" ] = dtick
@@ -512,6 +514,13 @@ def prep_ticks(ax, index, ax_type, props):
512514
513515 if formatter == "LogFormatterMathtext" :
514516 axis_dict ["exponentformat" ] = "e"
517+ elif formatter == "FuncFormatter" and props ["axes" ][index ]["tickformat" ] is not None :
518+ to_remove = ["dtick" "tickmode" ]
519+ for key in to_remove :
520+ if key in axis_dict :
521+ axis_dict .pop (key )
522+ axis_dict ["ticktext" ] = props ["axes" ][index ]["tickformat" ]
523+ axis_dict ["tickvals" ] = props ["axes" ][index ]["tickvalues" ]
515524 return axis_dict
516525
517526
0 commit comments