# plotting a histogram in julia with as many bins as values

**URL:** <https://discourse.julialang.org/t/plotting-a-histogram-in-julia-with-as-many-bins-as-values/102861>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 16, 2023, 1:49pm UTC](https://discourse.julialang.org/t/plotting-a-histogram-in-julia-with-as-many-bins-as-values/102861 "2023-08-16T13:49:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark01](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@Mark01](https://discourse.julialang.org/u/Mark01)\
**Post date:** [August 16, 2023, 1:49pm UTC](https://discourse.julialang.org/t/plotting-a-histogram-in-julia-with-as-many-bins-as-values/102861/1 "2023-08-16T13:49:06Z")

</div>

How do I make Julia Plots with the Plotly backend give me a histogram with as many integer bins from to max value in the series while displaying all the x-axis tick marks for each bin?

```julia
using Plots
plotly()
age = 100*rand(1000,1)
histogram(age, bins=100)

```

---

<div class="post-metadata">

**Author:** ![Daniel\_Berge](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@Daniel\_Berge](https://discourse.julialang.org/u/Daniel_Berge)\
**Post date:** [August 16, 2023, 2:32pm UTC](https://discourse.julialang.org/t/plotting-a-histogram-in-julia-with-as-many-bins-as-values/102861/2 "2023-08-16T14:32:24Z")

</div>

You can specify the bins for a histogram with a `AbstractVector` for the `bins` argument. You can also specify the ticks the same with `xticks`.

```julia
using Plots
plotly()
age = 100*rand(1000)
histogram(age, bins=0:100, xticks=0:100)

```
