# stack rect when rects are different widths

**URL:** https://talk.observablehq.com/t/stack-rect-when-rects-are-different-widths/8689
**Category:** Help
**Created:** [January 10, 2024, 5:35pm UTC](https://talk.observablehq.com/t/stack-rect-when-rects-are-different-widths/8689 "2024-01-10T17:35:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![fgregg](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/fgregg/32/7862_2.png) [@fgregg](https://talk.observablehq.com/u/fgregg)
#### Post date: [January 10, 2024, 5:35pm UTC](https://talk.observablehq.com/t/stack-rect-when-rects-are-different-widths/8689/1 "2024-01-10T17:35:38Z")

</div>

three groups of rectY, that overlap but with different widths the (x1 and x2).

I’d like the rectY to stack, but they are not.

> **[How long have asylum seekers been in Chicago Shelters](https://observablehq.com/d/432e2d3820d4a6e8#cell-16)**
>
> On November 17, 2023 the Brandon Johnson administration announced a policy that asylum seekers would be allowed to stay in shelters for 60 days. In their announcement, they divided the shelter population into three groups, as of the time of the...

```auto
Plot.plot({
  marks: [
    Plot.rectY(
      eviction_rate,
      Plot.stackY({
        x1: "start",
        x2: "end",
        y: (d) => d.count / ((d.end - d.start) / (1000 * 60 * 60 * 24)),
        fill: "group"
      })
    )
  ]
})

```

 ![untitled(87)](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/2X/3/3d80bacc8bb39954b577420df977cafb9885cb6d.png)

---

<div class="post-metadata">

### Author: ![CAYdenberg](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/caydenberg/32/5322_2.png) [@CAYdenberg](https://talk.observablehq.com/u/CAYdenberg)
#### Post date: [January 10, 2024, 10:29pm UTC](https://talk.observablehq.com/t/stack-rect-when-rects-are-different-widths/8689/2 "2024-01-10T22:29:24Z")

</div>

The stack transform works by identifying data that has a common x and then transforming the y values to sit on top of each other. I don’t think it will work if your rects have width (because what is “common”?)

I think to generate your data, you should start by creating an array that encompasses all dates in the range you’re interested in, and then populate it with the number of evictions in each group.
