# Plots Heatmap is not showing categorical variable

**URL:** <https://discourse.julialang.org/t/plots-heatmap-is-not-showing-categorical-variable/41340>\
**Category:** General Usage\
**Created:** [June 13, 2020, 8:43pm UTC](https://discourse.julialang.org/t/plots-heatmap-is-not-showing-categorical-variable/41340 "2020-06-13T20:43:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [June 13, 2020, 8:43pm UTC](https://discourse.julialang.org/t/plots-heatmap-is-not-showing-categorical-variable/41340/1 "2020-06-13T20:43:58Z")

</div>

I am trying to plot a heatmap where the data is coming from a `DataFrame`. The arrays look like the following

```julia
yvals = df_normal[:, :county]
xvals = names(df_normal)[dbegin:dend]
zvals = Matrix(df_normal[:, dbegin:dend])

```

where `df_normal` is my dataframe. The `xvals` and `yvals` are just strings, as seen by

```julia
julia> typeof(yvals)
Array{String,1}

julia> eltype(yvals)
String

```

except for some reason, heatmap does not work. If I pass in `yvals`, I get a message (not a warning/error),

```julia
julia> heatmap(xvals, yvals, zvals, size=(1000,1000))
y points not sorted in ascending order

```

and the heatmap itself is completely blank.

I can get it to work if I change the y axis to a numerical array… something like

```julia
julia> heatmap(xvals, 1:length(yvals), zvals, size=(1000,1000))

```

but then I lose my y axis strings.

Any idea?

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [June 13, 2020, 8:47pm UTC](https://discourse.julialang.org/t/plots-heatmap-is-not-showing-categorical-variable/41340/2 "2020-06-13T20:47:18Z")

</div>

What’s even more weird is that the example from the `Plots.jl` documentation works

```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, :))
heatmap(xs, ys, z, aspect_ratio = 1)

```

here, `xs` and `ys` are strings also … same as mine.

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [June 13, 2020, 9:29pm UTC](https://discourse.julialang.org/t/plots-heatmap-is-not-showing-categorical-variable/41340/3 "2020-06-13T21:29:34Z")

</div>

I figured it out. There were duplicates in my `yvals` and it works now that I’ve fixed it.
