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

Method _get_ticks_position

lib/matplotlib/axis.py:2444–2484  ·  view source on GitHub ↗

Helper for `XAxis.get_ticks_position` and `YAxis.get_ticks_position`. Check the visibility of tick1line, label1, tick2line, and label2 on the first major and the first minor ticks, provided these ticks are used i.e. the corresponding locator is not a NullLocator, an

(self)

Source from the content-addressed store, hash-verified

2442 raise NotImplementedError()
2443
2444 def _get_ticks_position(self):
2445 """
2446 Helper for `XAxis.get_ticks_position` and `YAxis.get_ticks_position`.
2447
2448 Check the visibility of tick1line, label1, tick2line, and label2 on
2449 the first major and the first minor ticks, provided these ticks are used
2450 i.e. the corresponding locator is not a NullLocator, and return
2451
2452 - 1 if only tick1line and label1 are visible (which corresponds to
2453 "bottom" for the x-axis and "left" for the y-axis);
2454 - 2 if only tick2line and label2 are visible (which corresponds to
2455 "top" for the x-axis and "right" for the y-axis);
2456 - "default" if only tick1line, tick2line and label1 are visible;
2457 - "unknown" otherwise.
2458 """
2459 representative_ticks = []
2460 if not isinstance(self.get_major_locator(), NullLocator):
2461 representative_ticks.append(self.majorTicks[0])
2462 if not isinstance(self.get_minor_locator(), NullLocator):
2463 representative_ticks.append(self.minorTicks[0])
2464
2465 if all(tick.tick1line.get_visible()
2466 and not tick.tick2line.get_visible()
2467 and tick.label1.get_visible()
2468 and not tick.label2.get_visible()
2469 for tick in representative_ticks):
2470 return 1
2471 elif all(tick.tick2line.get_visible()
2472 and not tick.tick1line.get_visible()
2473 and tick.label2.get_visible()
2474 and not tick.label1.get_visible()
2475 for tick in representative_ticks):
2476 return 2
2477 elif all(tick.tick1line.get_visible()
2478 and tick.tick2line.get_visible()
2479 and tick.label1.get_visible()
2480 and not tick.label2.get_visible()
2481 for tick in representative_ticks):
2482 return "default"
2483 else:
2484 return "unknown"
2485
2486 def get_label_position(self):
2487 """

Callers 2

get_ticks_positionMethod · 0.80
get_ticks_positionMethod · 0.80

Calls 3

get_major_locatorMethod · 0.95
get_minor_locatorMethod · 0.95
get_visibleMethod · 0.45

Tested by

no test coverage detected