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
Next Next commit
Changed index locator range
  • Loading branch information
rougier committed Sep 14, 2016
commit c827e5a33150a9071eb7d08af690dfbd2a27be10
11 changes: 5 additions & 6 deletions examples/ticks_and_spines/tick-locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ def setup(ax):
# Index Locator
ax = plt.subplot(n, 1, 5)
setup(ax)
ax.set_xlim(5, 55)
ax.plot(range(5, 55), [0]*50, color='White')
ax.xaxis.set_major_locator(ticker.IndexLocator(base=5, offset=2))
ax.text(0.0, 0.5, "IndexLocator (base=5, offset=2)",
ax.plot(range(0, 5), [0]*5, color='White')
ax.xaxis.set_major_locator(ticker.IndexLocator(base=.5, offset=.25))
ax.text(0.0, 0.5, "IndexLocator(base=0.5, offset=0.25)",
fontsize=14, transform=ax.transAxes)

# Auto Locator
Expand All @@ -78,15 +77,15 @@ def setup(ax):
setup(ax)
ax.xaxis.set_major_locator(ticker.MaxNLocator(4))
ax.xaxis.set_minor_locator(ticker.MaxNLocator(40))
ax.text(0.0, 0.5, "MaxNLocator (n=4)", fontsize=14, transform=ax.transAxes)
ax.text(0.0, 0.5, "MaxNLocator(n=4)", fontsize=14, transform=ax.transAxes)

# Log Locator
ax = plt.subplot(n, 1, 8)
setup(ax)
ax.set_xlim(10**3, 10**10)
ax.set_xscale('log')
ax.xaxis.set_major_locator(ticker.LogLocator(base=10.0, numticks=15))
ax.text(0.0, 0.5, "LogLocator(10,15)", fontsize=15, transform=ax.transAxes)
ax.text(0.0, 0.5, "LogLocator(base=10, numticks=15)", fontsize=15, transform=ax.transAxes)

plt.tight_layout()
# plt.savefig("tick-locators.pdf")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't need these.

Expand Down