@@ -520,22 +520,22 @@ class AutoDateFormatter(ticker.Formatter):
520
520
>>> formatter = AutoDateFormatter()
521
521
>>> formatter.scaled[1/(24.*60.)] = '%M:%S' # only show min and sec
522
522
523
- Custom `FunctionFormatter`s can also be used. The following example shows
523
+ A Custom :class:`~matplotlib.ticker.FuncFormatter` can also be used. The following example shows
524
524
how to use a custom format function to strip trailing zeros from decimal
525
525
seconds and adds the date to the first ticklabel::
526
526
527
- >>> def my_format_function(x, pos=None):
528
- ... x = matplotlib.dates.num2date(x)
529
- ... if pos == 0:
530
- ... fmt = '%D %H:%M:%S.%f'
531
- ... else:
532
- ... fmt = '%H:%M:%S.%f'
533
- ... label = x.strftime(fmt)
534
- ... label = label.rstrip("0")
535
- ... label = label.rstrip(".")
536
- ... return label
537
- >>> from matplotlib.ticker import FuncFormatter
538
- >>> formatter.scaled[1/(24.*60.)] = FuncFormatter(my_format_function)
527
+ >>> def my_format_function(x, pos=None):
528
+ ... x = matplotlib.dates.num2date(x)
529
+ ... if pos == 0:
530
+ ... fmt = '%D %H:%M:%S.%f'
531
+ ... else:
532
+ ... fmt = '%H:%M:%S.%f'
533
+ ... label = x.strftime(fmt)
534
+ ... label = label.rstrip("0")
535
+ ... label = label.rstrip(".")
536
+ ... return label
537
+ >>> from matplotlib.ticker import FuncFormatter
538
+ >>> formatter.scaled[1/(24.*60.)] = FuncFormatter(my_format_function)
539
539
"""
540
540
541
541
# This can be improved by providing some user-level direction on
0 commit comments