Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 55e11b4

Browse files
Code review updates
1 parent b020cd0 commit 55e11b4

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

lib/matplotlib/path.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import numpy as np
1717

1818
import matplotlib as mpl
19-
from . import _path
19+
from . import _api, _path
2020
from .cbook import _to_unmasked_float_array, simple_linear_interpolation
2121
from .bezier import BezierSegment
2222

@@ -126,10 +126,7 @@ def __init__(self, vertices, codes=None, _interpolation_steps=1,
126126
and codes as read-only arrays.
127127
"""
128128
vertices = _to_unmasked_float_array(vertices)
129-
if vertices.ndim != 2 or vertices.shape[1] != 2:
130-
raise ValueError(
131-
f"'vertices' must be 2D with shape (N, 2), "
132-
f"but your input has shape {vertices.shape}")
129+
_api.check_shape((None, 2), vertices=vertices)
133130

134131
if codes is not None and len(vertices):
135132
codes = np.asarray(codes, self.code_type)

lib/matplotlib/text.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ def _char_index_at(self, x):
361361
return (np.abs(size_accum - std_x)).argmin()
362362

363363
def get_rotation(self):
364-
"""Return the text angle in degrees between 0 and 360."""
364+
"""Return the text angle in degrees in the range [0, 360)."""
365365
if self.get_transform_rotates_text():
366366
return self.get_transform().transform_angles(
367-
[self._rotation], [self.get_unitless_position()]).item(0)
367+
[self._rotation], [self.get_unitless_position()]).item(0) % 360
368368
else:
369369
return self._rotation
370370

0 commit comments

Comments
 (0)