Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f6b7189

Browse filesBrowse files
committed
DOC: show that FuncFormatter can be a decorator
1 parent c44556f commit f6b7189
Copy full SHA for f6b7189

File tree

Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed

‎examples/ticks_and_spines/tick-formatters.py

Copy file name to clipboardExpand all lines: examples/ticks_and_spines/tick-formatters.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def setup(ax):
5151
fontsize=15, transform=ax.transAxes)
5252

5353

54-
# Func formatter
54+
# FuncFormatter can be used as a decorator
55+
@ticker.FuncFormatter
5556
def major_formatter(x, pos):
5657
return "[%.2f]" % x
5758

@@ -60,7 +61,7 @@ def major_formatter(x, pos):
6061
setup(ax)
6162
ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00))
6263
ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25))
63-
ax.xaxis.set_major_formatter(ticker.FuncFormatter(major_formatter))
64+
ax.xaxis.set_major_formatter(major_formatter)
6465
ax.text(0.0, 0.1, 'FuncFormatter(lambda x, pos: "[%.2f]" % x)',
6566
fontsize=15, transform=ax.transAxes)
6667

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.