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

Skip to content

Commit d3af67d

Browse files
afvincentjenshnielsen
authored andcommitted
Docstring/comments fixes & PEP8.
1 parent 6191dff commit d3af67d

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

lib/matplotlib/patches.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4072,7 +4072,7 @@ def set_dpi_cor(self, dpi_cor):
40724072
def get_dpi_cor(self):
40734073
"""
40744074
dpi_cor is currently used for linewidth-related things and
4075-
shrink factor. Mutation scale *is now* affected by this.
4075+
shrink factor. Mutation scale is affected by this.
40764076
"""
40774077

40784078
return self._dpi_cor
@@ -4224,11 +4224,12 @@ def get_path_in_displaycoord(self):
42244224
patchB=self.patchB,
42254225
shrinkA=self.shrinkA * dpi_cor,
42264226
shrinkB=self.shrinkB * dpi_cor
4227-
)
4227+
)
42284228
else:
42294229
_path = self.get_transform().transform_path(self._path_original)
42304230

4231-
_path, fillable = self.get_arrowstyle()(_path,
4231+
_path, fillable = self.get_arrowstyle()(
4232+
_path,
42324233
self.get_mutation_scale() * dpi_cor,
42334234
self.get_linewidth() * dpi_cor,
42344235
self.get_mutation_aspect()
@@ -4542,13 +4543,14 @@ def get_path_in_displaycoord(self):
45424543
patchB=self.patchB,
45434544
shrinkA=self.shrinkA * dpi_cor,
45444545
shrinkB=self.shrinkB * dpi_cor
4545-
)
4546+
)
45464547

4547-
_path, fillable = self.get_arrowstyle()(_path,
4548+
_path, fillable = self.get_arrowstyle()(
4549+
_path,
45484550
self.get_mutation_scale() * dpi_cor,
45494551
self.get_linewidth() * dpi_cor,
45504552
self.get_mutation_aspect()
4551-
)
4553+
)
45524554

45534555
return _path, fillable
45544556

lib/matplotlib/tests/test_arrow_patches.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import matplotlib.pyplot as plt
77
from matplotlib.testing.decorators import image_comparison
8-
import matplotlib.patches as mpatches # adopting scipy import conventions
8+
import matplotlib.patches as mpatches
99

1010

1111
def draw_arrow(ax, t, r):
@@ -54,7 +54,7 @@ def test_boxarrow():
5454

5555
def prepare_fancyarrow_dpi_cor_test():
5656
"""
57-
Convenience function that prepares and return a FancyArrowPatch. It aims
57+
Convenience function that prepares and returns a FancyArrowPatch. It aims
5858
at being used to test that the size of the arrow head does not depend on
5959
the DPI value of the exported picture.
6060
@@ -76,7 +76,7 @@ def prepare_fancyarrow_dpi_cor_test():
7676
def test_fancyarrow_dpi_cor_100dpi():
7777
"""
7878
Check the export of a FancyArrowPatch @ 100 DPI. FancyArrowPatch is
79-
instanciated through a dedicated function because another similar test
79+
instantiated through a dedicated function because another similar test
8080
checks a similar export but with a different DPI value.
8181
8282
Remark: test only a rasterized format.

lib/matplotlib/text.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,14 +2163,7 @@ def _update_position_xytext(self, renderer, xy_pixel):
21632163
" use 'headlength' to set the head length in points.")
21642164
headlength = d.pop('headlength', 12)
21652165

2166-
# Old way:
2167-
# ms_pix = renderer.points_to_pixels(ms)
2168-
# to_style = self.figure.dpi / (72 * ms_pix)
2169-
# NB: is there a reason to use self.figure.dpi / (72 * ms_pix)
2170-
# instead of renderer.points_to_pixels(1.) / ms_pix? Both
2171-
# should be equal to '1 / ms', shouldn't they (by the way)?
2172-
#
2173-
# New way: '* to_style' <- '/ ms' (ms is now still in pts here)
2166+
# NB: ms is in pts
21742167
stylekw = dict(head_length=headlength / ms,
21752168
head_width=headwidth / ms,
21762169
tail_width=width / ms)

0 commit comments

Comments
 (0)