# Using Plot.bin and other transforms outside a graph context?

**URL:** <https://talk.observablehq.com/t/using-plot-bin-and-other-transforms-outside-a-graph-context/6737>\
**Category:** Help\
**Created:** [June 24, 2022, 11:36am UTC](https://talk.observablehq.com/t/using-plot-bin-and-other-transforms-outside-a-graph-context/6737 "2022-06-24T11:36:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hebo](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/hebo/32/6672_2.png) [@Hebo](https://talk.observablehq.com/u/Hebo)\
**Post date:** [June 24, 2022, 11:36am UTC](https://talk.observablehq.com/t/using-plot-bin-and-other-transforms-outside-a-graph-context/6737/1 "2022-06-24T11:36:59Z")

</div>

Hey, been diving into Observable and generally love it. I’ve been trying to figure out how to pull data from a graph and use it in other contexts, such as an html block that explains or does additional computation on a value.

Specifically, I’d like to take a transform like `Plot.binX` and figure out the underlying bins it generates, so I can write a statement like “`The average for ${bins[0]} is ${average(bins[0])}`”

I’ve been doing this previously by embedding values I need into the svg with `ariaLabel` and then querying the DOM, but I’m sure there’s a better way.

---

<div class="post-metadata">

**Author:** ![Cobus](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/cobus/32/9670_2.png) [@Cobus](https://talk.observablehq.com/u/Cobus)\
**Post date:** [June 24, 2022, 12:39pm UTC](https://talk.observablehq.com/t/using-plot-bin-and-other-transforms-outside-a-graph-context/6737/2 "2022-06-24T12:39:24Z")

</div>

Hi, I think this might answer your question:

> [@Using plot() for data refinement only](https://talk.observablehq.com/t/using-plot-for-data-refinement-only/6722):
>
> Hi there, I am having a hard time refining my dataset with d3.group() and d3.rollup() and was wondering if it would be possible to use the easy syntax of the Plot library for grouping and stuff like that on the data records. I had something in mind like plot(data, plot.group({y: "count"}, {x: "age", y: ""})).getData(). Just a quick idea, maybe I just missed the point completely.

---

<div class="post-metadata">

**Author:** ![Hebo](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/hebo/32/6672_2.png) [@Hebo](https://talk.observablehq.com/u/Hebo)\
**Post date:** [June 25, 2022, 6:25am UTC](https://talk.observablehq.com/t/using-plot-bin-and-other-transforms-outside-a-graph-context/6737/3 "2022-06-25T06:25:01Z")

</div>

It sure does, thank you!
