Initialize the label and offsetText instance values and `label_position` / `offset_text_position`.
(self)
| 2543 | self._init() |
| 2544 | |
| 2545 | def _init(self): |
| 2546 | """ |
| 2547 | Initialize the label and offsetText instance values and |
| 2548 | `label_position` / `offset_text_position`. |
| 2549 | """ |
| 2550 | # x in axes coords, y in display coords (to be updated at draw time by |
| 2551 | # _update_label_positions and _update_offset_text_position). |
| 2552 | self.label.set( |
| 2553 | x=0.5, y=0, |
| 2554 | verticalalignment='top', horizontalalignment='center', |
| 2555 | transform=mtransforms.blended_transform_factory( |
| 2556 | self.axes.transAxes, mtransforms.IdentityTransform()), |
| 2557 | ) |
| 2558 | self.label_position = 'bottom' |
| 2559 | |
| 2560 | if mpl.rcParams['xtick.labelcolor'] == 'inherit': |
| 2561 | tick_color = mpl.rcParams['xtick.color'] |
| 2562 | else: |
| 2563 | tick_color = mpl.rcParams['xtick.labelcolor'] |
| 2564 | |
| 2565 | self.offsetText.set( |
| 2566 | x=1, y=0, |
| 2567 | verticalalignment='top', horizontalalignment='right', |
| 2568 | transform=mtransforms.blended_transform_factory( |
| 2569 | self.axes.transAxes, mtransforms.IdentityTransform()), |
| 2570 | fontsize=mpl.rcParams['xtick.labelsize'], |
| 2571 | color=tick_color |
| 2572 | ) |
| 2573 | self.offset_text_position = 'bottom' |
| 2574 | |
| 2575 | def contains(self, mouseevent): |
| 2576 | """Test whether the mouse event occurred in the x-axis.""" |