# Getting bin values from histogram

**URL:** https://discourse.julialang.org/t/getting-bin-values-from-histogram/114985
**Category:** Visualization
**Tags:** question, plotting, plots, histogram
**Created:** [May 30, 2024, 8:47pm UTC](https://discourse.julialang.org/t/getting-bin-values-from-histogram/114985 "2024-05-30T20:47:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![bsuwal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bsuwal/32/19577_2.png) [@bsuwal](https://discourse.julialang.org/u/bsuwal)
#### Post date: [May 30, 2024, 8:47pm UTC](https://discourse.julialang.org/t/getting-bin-values-from-histogram/114985/1 "2024-05-30T20:47:40Z")

</div>

I wish to get the values of the bins in a histogram I make using Plots.jl. For example, if I use the following sample code

```julia
using Plots

data = randn(100)
histogram(data, normalize=:probability)

```

I wish to learn what the y-values are of each bin. Is there a way for me to do that?

---

<div class="post-metadata">

### Author: ![sgaure](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sgaure/32/14779_2.png) [@sgaure](https://discourse.julialang.org/u/sgaure)
#### Post date: [May 30, 2024, 9:00pm UTC](https://discourse.julialang.org/t/getting-bin-values-from-histogram/114985/2 "2024-05-30T21:00:27Z")

</div>

```julia
using StatsBase, LinearAlgebra

h = normalize(fit(Histogram, randn(100)), mode=:probability)

```

gives you a structure `h` with components `edges` and `weights`.
