|
55 | 55 | arrow more pointed, reduce *headwidth* or increase *headlength* and |
56 | 56 | *headaxislength*. To make the head smaller relative to the shaft, |
57 | 57 | scale down all the head parameters. You will probably do best to leave |
58 | | -minshaft alone. |
| 58 | +*minshaft* alone. |
59 | 59 |
|
60 | 60 | **Arrow outline** |
61 | 61 |
|
@@ -595,32 +595,18 @@ def set_UVC(self, U, V, C=None): |
595 | 595 | self.stale = True |
596 | 596 |
|
597 | 597 | def _dots_per_unit(self, units): |
598 | | - """ |
599 | | - Return a scale factor for converting from units to pixels |
600 | | - """ |
601 | | - if units in ('x', 'y', 'xy'): |
602 | | - if units == 'x': |
603 | | - dx0 = self.axes.viewLim.width |
604 | | - dx1 = self.axes.bbox.width |
605 | | - elif units == 'y': |
606 | | - dx0 = self.axes.viewLim.height |
607 | | - dx1 = self.axes.bbox.height |
608 | | - else: # 'xy', i.e. hypot(x, y) |
609 | | - dx0 = np.hypot(*self.axes.viewLim.size) |
610 | | - dx1 = np.hypot(*self.axes.bbox.size) |
611 | | - dx = dx1 / dx0 |
612 | | - else: |
613 | | - if units == 'width': |
614 | | - dx = self.axes.bbox.width |
615 | | - elif units == 'height': |
616 | | - dx = self.axes.bbox.height |
617 | | - elif units == 'dots': |
618 | | - dx = 1.0 |
619 | | - elif units == 'inches': |
620 | | - dx = self.axes.figure.dpi |
621 | | - else: |
622 | | - raise ValueError('unrecognized units') |
623 | | - return dx |
| 598 | + """Return a scale factor for converting from units to pixels.""" |
| 599 | + bb = self.axes.bbox |
| 600 | + vl = self.axes.viewLim |
| 601 | + return _api.check_getitem({ |
| 602 | + 'x': bb.width / vl.width, |
| 603 | + 'y': bb.height / vl.height, |
| 604 | + 'xy': np.hypot(*bb.size) / np.hypot(*vl.size), |
| 605 | + 'width': bb.width, |
| 606 | + 'height': bb.height, |
| 607 | + 'dots': 1., |
| 608 | + 'inches': self.axes.figure.dpi, |
| 609 | + }, units=units) |
624 | 610 |
|
625 | 611 | def _set_transform(self): |
626 | 612 | """ |
|
0 commit comments