# Arrange points by x and y and create tree for each row

**URL:** <https://discourse.mcneel.com/t/arrange-points-by-x-and-y-and-create-tree-for-each-row/214344>\
**Category:** Grasshopper\
**Tags:** windows\
**Created:** [January 9, 2026, 4:02am UTC](https://discourse.mcneel.com/t/arrange-points-by-x-and-y-and-create-tree-for-each-row/214344 "2026-01-09T04:02:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Imran\_Hakim](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/imran_hakim/32/712284_2.png) [@Imran\_Hakim](https://discourse.mcneel.com/u/Imran_Hakim)\
**Post date:** [January 9, 2026, 4:02am UTC](https://discourse.mcneel.com/t/arrange-points-by-x-and-y-and-create-tree-for-each-row/214344/1 "2026-01-09T04:02:43Z")

</div>

Hi, is there a component that can do this in grasshopper? or is there a plugin that anyone is familiar with to do so?

say for a list of points (for example these points are all under {0}, how can i seperate them into trees {0;\*} or {0},{n+1} based on the x and y as shown below?

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/d/1/6/d1695ffb3e7d2188116d70e228a522eb626fec0c.png)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/1/8/7/187846fa5c37aa7c2e55c1f2786d1628c02bf23c.png)

---

<div class="post-metadata">

**Author:** ![grbl9789](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/grbl9789/32/600793_2.png) [@grbl9789](https://discourse.mcneel.com/u/grbl9789)\
**Post date:** [January 9, 2026, 4:25am UTC](https://discourse.mcneel.com/t/arrange-points-by-x-and-y-and-create-tree-for-each-row/214344/2 "2026-01-09T04:25:21Z")

</div>

> **[Chapter 3: Advanced Data Structures](https://developer.rhino3d.com/guides/grasshopper/gh-algorithms-and-data-structures/advanced-data-structures/)**

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/0/7/2/072d3f484379f17aa0fb1d688887f6a6764d2081.png)

---

<div class="post-metadata">

**Author:** ![Imran\_Hakim](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/imran_hakim/32/712284_2.png) [@Imran\_Hakim](https://discourse.mcneel.com/u/Imran_Hakim)\
**Post date:** [January 9, 2026, 4:27am UTC](https://discourse.mcneel.com/t/arrange-points-by-x-and-y-and-create-tree-for-each-row/214344/3 "2026-01-09T04:27:51Z")

</div>

sorry i should have been clearer, what im trying to say is that im trying to convert those points and assuming its all in a single list, break it down into seperate trees according to x and y

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/498369_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [January 9, 2026, 5:00am UTC](https://discourse.mcneel.com/t/arrange-points-by-x-and-y-and-create-tree-for-each-row/214344/4 "2026-01-09T05:00:53Z")

</div>

> [@How to make trees of data into one line?](https://discourse.mcneel.com/t/how-to-make-trees-of-data-into-one-line/214309/8):
>
> [GH Help mrtn.gh](https://discourse.mcneel.com/uploads/short-url/bLJnSFTdI394eC9fxoJCX9ANFbo.gh) (11.6 KB)

Have you looked at this?

The result is one tree with multiple branches containing horizontally sorted points.

Is that not what you’re looking for?

---

<div class="post-metadata">

**Author:** ![Tom\_Newsom](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/tom_newsom/32/618795_2.png) [@Tom\_Newsom](https://discourse.mcneel.com/u/Tom_Newsom)\
**Post date:** [January 9, 2026, 2:40pm UTC](https://discourse.mcneel.com/t/arrange-points-by-x-and-y-and-create-tree-for-each-row/214344/5 "2026-01-09T14:40:08Z")

</div>

If your points are neatly aligned on their rows, then use my method:

> [@Sorting points in sequence](https://discourse.mcneel.com/t/sorting-points-in-sequence/206572/6):
>
> Bit of a hacky way to do it (relying on either side of the decimal point for sorting each axis), especially if you end up needing more structured data later, because the columns are not distinguished. I suspect it will also get confused by very small separations in Y. Here’s another way of doing it that sorts by X first, then uses a Create Set component to identify the unique X positions and the Map output (ie. which Set value does each List Item match?) to allocate each point to a tree branch …

If they’re more roughly lined up, use @inno’s variation, which follows in that thread.

---

<div class="post-metadata">

**Author:** ![grbl9789](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/grbl9789/32/600793_2.png) [@grbl9789](https://discourse.mcneel.com/u/grbl9789)\
**Post date:** [January 9, 2026, 9:21pm UTC](https://discourse.mcneel.com/t/arrange-points-by-x-and-y-and-create-tree-for-each-row/214344/6 "2026-01-09T21:21:58Z")

</div>

If they are in order, it would be “Partition List” to get your blue rows, and “Flip matrix” to get your red columns. All in the link I sent.
