# Plotting a histogram of multiple independent univariate dataseries in a 2d heatmap

**URL:** <https://discourse.julialang.org/t/plotting-a-histogram-of-multiple-independent-univariate-dataseries-in-a-2d-heatmap/109840>\
**Category:** General Usage\
**Tags:** question, plotting, statistics\
**Created:** [February 6, 2024, 10:45pm UTC](https://discourse.julialang.org/t/plotting-a-histogram-of-multiple-independent-univariate-dataseries-in-a-2d-heatmap/109840 "2024-02-06T22:45:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JBH\_84](https://avatars.discourse-cdn.com/v4/letter/j/c37758/32.png) [@JBH\_84](https://discourse.julialang.org/u/JBH_84)\
**Post date:** [February 6, 2024, 10:45pm UTC](https://discourse.julialang.org/t/plotting-a-histogram-of-multiple-independent-univariate-dataseries-in-a-2d-heatmap/109840/1 "2024-02-06T22:45:39Z")

</div>

I would like to do something similar to the example

```julia
xs = [string("x", i) for i = 1:10]
ys = [string("y", i) for i = 1:4]
z = float((1:4) * reshape(1:10, 1, :)) * u"km"
heatmap(xs, ys, z, aspect_ratio=1)

```

however, in my desired example:  
xs represents the histogram bins (which will be fixed)  
ys represents the different dataseries of the univariate variable of interest  
z represents the bin count of the ys dataseries for the particular value using xs as the bins. ultimately i would set normalize=:pdf to have the scale range from [0,1]

originally i used heatmap2d but realized this is for applications where your system is a function of 2 independent variables. i have single distribution of xs values (e.g., temps) across multiple ys values (weather years) and i want a nice way to view the histogram of each yr independent from one another

sorry if this is a basic ?. im new to julia and still getting up to speed

thanks in advance

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [March 6, 2024, 2:36pm UTC](https://discourse.julialang.org/t/plotting-a-histogram-of-multiple-independent-univariate-dataseries-in-a-2d-heatmap/109840/2 "2024-03-06T14:36:05Z")

</div>

What about computing `znorm = z ./ sum.(eachrow(z)` and making the 2D heatmap with that?

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [March 6, 2024, 2:44pm UTC](https://discourse.julialang.org/t/plotting-a-histogram-of-multiple-independent-univariate-dataseries-in-a-2d-heatmap/109840/3 "2024-03-06T14:44:52Z")

</div>

You means figures [like this](https://www.generic-mapping-tools.org/GMTjl_doc/examples/plotting_functions/03_bars/#make_a_3d_bar_plot_with_constant_color)?
