Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a8310dc

Browse files
committed
Add a short example to StrMethodFormatter docstring
1 parent 30c3d78 commit a8310dc

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/matplotlib/ticker.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,12 @@ class StrMethodFormatter(Formatter):
388388
It is typically unnecessary to explicitly construct `.StrMethodFormatter`
389389
objects, as `~.Axis.set_major_formatter` directly accepts the format string
390390
itself.
391+
392+
Examples
393+
--------
394+
>>> formatter = StrMethodFormatter("{x} km")
395+
>>> formatter(10)
396+
"10 km"
391397
"""
392398

393399
def __init__(self, fmt):

0 commit comments

Comments
 (0)