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

Method _get_dist_to_box

lib/matplotlib/text.py:755–776  ·  view source on GitHub ↗

Return the distance from the given points to the boundaries of a rotated box, in pixels.

(self, rotation, x0, y0, figure_box)

Source from the content-addressed store, hash-verified

753 return line_width
754
755 def _get_dist_to_box(self, rotation, x0, y0, figure_box):
756 """
757 Return the distance from the given points to the boundaries of a
758 rotated box, in pixels.
759 """
760 if rotation > 270:
761 quad = rotation - 270
762 h1 = (y0 - figure_box.y0) / math.cos(math.radians(quad))
763 h2 = (figure_box.x1 - x0) / math.cos(math.radians(90 - quad))
764 elif rotation > 180:
765 quad = rotation - 180
766 h1 = (x0 - figure_box.x0) / math.cos(math.radians(quad))
767 h2 = (y0 - figure_box.y0) / math.cos(math.radians(90 - quad))
768 elif rotation > 90:
769 quad = rotation - 90
770 h1 = (figure_box.y1 - y0) / math.cos(math.radians(quad))
771 h2 = (x0 - figure_box.x0) / math.cos(math.radians(90 - quad))
772 else:
773 h1 = (figure_box.x1 - x0) / math.cos(math.radians(rotation))
774 h2 = (figure_box.y1 - y0) / math.cos(math.radians(90 - rotation))
775
776 return min(h1, h2)
777
778 def _get_rendered_text_width(self, text):
779 """

Callers 1

_get_wrap_line_widthMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected