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

Skip to content

Commit bc359be

Browse files
committed
DOC: modify examples to fix number of ticks
In the inset axes (which will not have tick labels) fix the number of ticks instead of letting auto-ticker pick the number of ticks.
1 parent 57623d6 commit bc359be

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

examples/axes_grid/inset_locator_demo.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ def add_sizebar(ax, size):
3232
ax2.set_aspect(1.)
3333

3434
axins = zoomed_inset_axes(ax2, 0.5, loc=1) # zoom = 0.5
35+
# fix the number of ticks on the inset axes
36+
axins.yaxis.get_major_locator().set_params(nbins=7)
37+
axins.xaxis.get_major_locator().set_params(nbins=7)
3538

3639
plt.xticks(visible=False)
3740
plt.yticks(visible=False)

examples/axes_grid/inset_locator_demo2.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def get_demo_image():
3434
x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9
3535
axins.set_xlim(x1, x2)
3636
axins.set_ylim(y1, y2)
37+
# fix the number of ticks on the inset axes
38+
axins.yaxis.get_major_locator().set_params(nbins=7)
39+
axins.xaxis.get_major_locator().set_params(nbins=7)
3740

3841
plt.xticks(visible=False)
3942
plt.yticks(visible=False)

0 commit comments

Comments
 (0)