# Plots.jl plotly heatmap labels

**URL:** <https://discourse.julialang.org/t/plots-jl-plotly-heatmap-labels/106252>\
**Category:** Visualization\
**Tags:** dates, plots, plotlyjs\
**Created:** [November 15, 2023, 8:44am UTC](https://discourse.julialang.org/t/plots-jl-plotly-heatmap-labels/106252 "2023-11-15T08:44:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![this\_josh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/this_josh/32/42679_2.png) [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Post date:** [November 15, 2023, 8:44am UTC](https://discourse.julialang.org/t/plots-jl-plotly-heatmap-labels/106252/1 "2023-11-15T08:44:08Z")

</div>

I’d like to create a large heatmap using `Plots.jl` and plotly. which should look like this, where all y axis labels are shown, these align with the tool tip, and if I zoom in I get an increased granularity of the x axis dates (this also occurs with the y axis).

 ![Screenshot 2023-11-15 at 08.35.56](https://global.discourse-cdn.com/julialang/original/3X/9/5/953589c98bcfe5d025ef35d936c769343f07e09e.png)

> **Made with \`PlotlyJS.jl**
>
> ```julia
> using Dates, PlotlyJS
> start_date = DateTime(2021, 1, 1)
> rr = rand(100,36)
> xaxis = start_date:Dates.Month(1):start_date+Dates.Month(36)
> yaxis = 15:115 |> collect .|> string
> plot(heatmap(x=xaxis, y=yaxis, z=rr))
> 
> ```

My understanding of `Plots.jl` is that if axis labels are given as strings they should all be shown, however, this is not the case. Here I get the following, note not all y labels are shown, if I zoom I don’t get any increased granularity (this also applies to the x axis), also the tool tip is less helpful with it not showing a date or a valid y axis label.

 ![Screenshot 2023-11-15 at 08.41.07](https://global.discourse-cdn.com/julialang/original/3X/b/a/ba25bca48c4a9e64f3a7676cc9ca1860aa1931a4.png)

> **Made with \`Plots.jl**
>
> ```julia
> using Dates, Plots
> plotlyjs()
> start_date = DateTime(2021, 1, 1)
> rr = rand(100,36)
> xaxis = start_date:Dates.Month(1):start_date+Dates.Month(36)
> yaxis = 15:115 |> collect .|> string
> heatmap(xaxis, yaxis, rr)
> 
> ```

> How can I produce something like the top figure with `Plots.jl`?

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [November 15, 2023, 9:54pm UTC](https://discourse.julialang.org/t/plots-jl-plotly-heatmap-labels/106252/2 "2023-11-15T21:54:11Z")

</div>

In Plots.jl, you could try the following code:

```julia
using Dates, Plots; plotlyjs()

start_date = DateTime(2021, 1, 1)
rr = rand(100,36)
xaxis = start_date:Dates.Month(1):start_date+Dates.Month(36)
DateTick = Dates.format.(xaxis, "yyyy-mm")
x = 1:length(xaxis)
yaxis = 15:115
heatmap(x, yaxis, rr, ticks=:native, xticks=(x,DateTick), xtickfontsize=5, xrot=45)

```

 ![Plots_plotlyjs_heatmap_dates_zoom_ticks_native](https://global.discourse-cdn.com/julialang/original/3X/a/0/a0ec163c21c017ab4ec783594a4b20fc5a9e57d4.png)

---

<div class="post-metadata">

**Author:** ![this\_josh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/this_josh/32/42679_2.png) [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Post date:** [November 17, 2023, 8:58am UTC](https://discourse.julialang.org/t/plots-jl-plotly-heatmap-labels/106252/3 "2023-11-17T08:58:23Z")

</div>

Thank you that’s great.
