File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -335,6 +335,10 @@ def make_compound_path_from_polys(cls, XY):
335
335
@classmethod
336
336
def make_compound_path (cls , * args ):
337
337
"""Make a compound path from a list of Path objects."""
338
+ # Handle an empty list in args (i.e. no args).
339
+ if not args :
340
+ return Path (np .empty ([0 , 2 ], dtype = np .float32 ))
341
+
338
342
lengths = [len (x ) for x in args ]
339
343
total_length = sum (lengths )
340
344
Original file line number Diff line number Diff line change 7
7
8
8
from matplotlib .path import Path
9
9
from matplotlib .patches import Polygon
10
- from nose .tools import assert_raises
10
+ from nose .tools import assert_raises , assert_equal
11
11
from matplotlib .testing .decorators import image_comparison
12
12
import matplotlib .pyplot as plt
13
13
@@ -82,6 +82,13 @@ def test_log_transform_with_zero():
82
82
ax .grid (True )
83
83
84
84
85
+ def test_make_compound_path_empty ():
86
+ # We should be able to make a compound path with no arguments.
87
+ # This makes it easier to write generic path based code.
88
+ r = Path .make_compound_path ()
89
+ assert_equal (r .vertices .shape , (0 , 2 ))
90
+
91
+
85
92
if __name__ == '__main__' :
86
93
import nose
87
94
nose .runmodule (argv = ['-s' , '--with-doctest' ], exit = False )
You can’t perform that action at this time.
0 commit comments