Skip to content

[DOC] Tick locators & formatters examples #7084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Sep 22, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Removed unused function
  • Loading branch information
rougier committed Sep 17, 2016
commit 0875843fc43fc4bef6c02d8c0061f94357ce8c24
7 changes: 2 additions & 5 deletions examples/ticks_and_spines/tick-formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,13 @@ def major_formatter(x, pos):
return "[%.2f]" % x


def minor_formatter(x, pos):
return "(%.2f)" % x


ax = plt.subplot(n, 1, 3)
setup(ax)
ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00))
ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25))
ax.xaxis.set_major_formatter(ticker.FuncFormatter(major_formatter))
ax.text(0.0, 0.5, "FuncFormatter(myfunc)", fontsize=15, transform=ax.transAxes)
ax.text(0.0, 0.5, 'FuncFormatter(lambda x, pos: "[%.2f]" % x)',
fontsize=15, transform=ax.transAxes)


# FormatStr formatter
Expand Down