MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / set_ticks_position

Method set_ticks_position

lib/matplotlib/axis.py:2655–2692  ·  view source on GitHub ↗

Set the ticks position. Parameters ---------- position : {'top', 'bottom', 'both', 'default', 'none'} 'both' sets the ticks to appear on both positions, but does not change the tick labels. 'default' resets the tick positions to

(self, position)

Source from the content-addressed store, hash-verified

2653 self.offsetText.set_position((x, y))
2654
2655 def set_ticks_position(self, position):
2656 """
2657 Set the ticks position.
2658
2659 Parameters
2660 ----------
2661 position : {'top', 'bottom', 'both', 'default', 'none'}
2662 'both' sets the ticks to appear on both positions, but does not
2663 change the tick labels. 'default' resets the tick positions to
2664 the default: ticks on both positions, labels at bottom. 'none'
2665 can be used if you don't want any ticks. 'none' and 'both'
2666 affect only the ticks, not the labels.
2667 """
2668 if position == 'top':
2669 self.set_tick_params(which='both', top=True, labeltop=True,
2670 bottom=False, labelbottom=False)
2671 self._tick_position = 'top'
2672 self.offsetText.set_verticalalignment('bottom')
2673 elif position == 'bottom':
2674 self.set_tick_params(which='both', top=False, labeltop=False,
2675 bottom=True, labelbottom=True)
2676 self._tick_position = 'bottom'
2677 self.offsetText.set_verticalalignment('top')
2678 elif position == 'both':
2679 self.set_tick_params(which='both', top=True,
2680 bottom=True)
2681 elif position == 'none':
2682 self.set_tick_params(which='both', top=False,
2683 bottom=False)
2684 elif position == 'default':
2685 self.set_tick_params(which='both', top=True, labeltop=False,
2686 bottom=True, labelbottom=True)
2687 self._tick_position = 'bottom'
2688 self.offsetText.set_verticalalignment('top')
2689 else:
2690 _api.check_in_list(['top', 'bottom', 'both', 'default', 'none'],
2691 position=position)
2692 self.stale = True
2693
2694 def tick_top(self):
2695 """

Callers 15

tick_topMethod · 0.95
tick_bottomMethod · 0.95
clearMethod · 0.45
clearMethod · 0.45
clearMethod · 0.45
spyMethod · 0.45
matshowMethod · 0.45
__init__Method · 0.45
set_alignmentMethod · 0.45
test_clipperFunction · 0.45

Calls 2

set_tick_paramsMethod · 0.80
set_verticalalignmentMethod · 0.80

Tested by 8

test_clipperFunction · 0.36
test_label_without_ticksFunction · 0.36
test_spyFunction · 0.36
test_matshowFunction · 0.36
test_title_xticks_topFunction · 0.36
test_spy_boxFunction · 0.36