|
From: Francesco M. <fra...@gm...> - 2014-11-27 17:17:33
|
Hi, put all them into a list ps = [p1, p2, ..., pn] and then unpack them path.Path.make_compound_path(*ps) Cheers, Fra ps: this is standard python unpacking 2014-11-27 18:12 GMT+01:00 Evan Mason <eva...@gm...>: > Hi, I have several path objects that I want to join together with > make_compound_path. > > For example, with p1 and p2: > > In [136]: p1 > Out[136]: > Path(array([[-29.85721973, -30. ], > [-29.84752676, -29.77715877], > [-29.88734508, -29.55431755], > [-29.97470553, -29.33147632], > [-30. , -29.28831083]]), None) > > In [138]: p2 > Out[138]: > Path(array([[-30. , 45.0000166 ], > [-29.94756898, 45.09749304], > [-29.87227011, 45.32033426], > [-29.84525888, 45.54317549], > [-29.86787108, 45.76601671], > [-29.93898847, 45.98885794], > [-30. , 46.10595725]]), None) > > I can do path.Path.make_compound_path(p1, p2) which joins them > successfully. > If I have a another path, p3, I can do: > path.Path.make_compound_path(p1, p2,p3), and so on. > > However, in my script I never know how many paths I will have, so I'd like > to put them into some sort of container, and pass that to > make_compound_path. I've tried lists: > > > In [140]: p1p2 = [p1, p2] > > In [141]: path.Path.make_compound_path(p1p2) > --------------------------------------------------------------------------- > AttributeError Traceback (most recent call last) > <ipython-input-141-eb62de9fcada> in <module>() > ----> 1 path.Path.make_compound_path(p1p2) > > /usr/lib64/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg > /matplotlib/path.py > in make_compound_path(cls, *args) > 330 total_length = sum(lengths) > 331 > --> 332 vertices = np.vstack([x.vertices for x in args]) > 333 vertices.reshape((total_length, 2)) > 334 > > AttributeError: 'list' object has no attribute 'vertices' > > > without success. Can anybody suggest a way to do this? > > Thanks, Evan > > > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > > http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |