# Annotated heatmaps in Gadfly do not fully show the annotations in the first and last column

**URL:** <https://discourse.julialang.org/t/annotated-heatmaps-in-gadfly-do-not-fully-show-the-annotations-in-the-first-and-last-column/81217>\
**Category:** General Usage\
**Tags:** question, package, plotting, gadfly\
**Created:** [May 17, 2022, 8:01pm UTC](https://discourse.julialang.org/t/annotated-heatmaps-in-gadfly-do-not-fully-show-the-annotations-in-the-first-and-last-column/81217 "2022-05-17T20:01:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brinkhuis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brinkhuis/32/18752_2.png) [@Brinkhuis](https://discourse.julialang.org/u/Brinkhuis)\
**Post date:** [May 17, 2022, 8:01pm UTC](https://discourse.julialang.org/t/annotated-heatmaps-in-gadfly-do-not-fully-show-the-annotations-in-the-first-and-last-column/81217/1 "2022-05-17T20:01:59Z")

</div>

Coming from Python I tried to reproduce [this](https://seaborn.pydata.org/examples/spreadsheet_heatmap.html) Seaborn heatmap using Gadfly. The (only) issue I have is that the first and last columns appear smaller than the other columns. As a result the annotations are not fully readable. Is there an option to set all cells to “equal squares” or an other solution?

```julia
using DataFrames
using CSV
using Gadfly
using Compose
using ColorSchemes 

# download dataset
download("https://raw.githubusercontent.com/mwaskom/seaborn-data/master/flights.csv", "flights.csv");
flights = DataFrame(CSV.File("flights.csv"))

# prepare annotation
flights_unstacked = unstack(flights, :month, :year, :passengers)
x = [x for x in 1949:1960 for y in 1:12]
y = repeat(collect(1:12), outer=12)
txt = string.(Array(flights_unstacked[:, 2:end]))

# plot heatmap
set_default_plot_size(16cm, 12cm)
plot(
    flights, 
    x=:year, 
    y=:month, 
    color=:passengers, 
    Geom.rectbin, 
    Scale.ContinuousColorScale(palette -> get(ColorSchemes.magma, palette)), 
    Coord.cartesian(xmin=minimum(flights.year), xmax=maximum(flights.year)), 
    Guide.xticks(ticks=[minimum(flights.year):maximum(flights.year);]), 
    Theme(background_color = "white"),

    Guide.annotation(
        compose(
            context(), 
            text(x, y, txt, [hcenter], [vcenter]), 
            fontsize(7pt), 
            stroke("white")
            )
        ),
)

```

 ![Heatmap](https://global.discourse-cdn.com/julialang/original/3X/9/8/985f7eac6ae334c6fbeaf350d88cdb0a6062c9a3.jpeg)

---

<div class="post-metadata">

**Author:** ![Brinkhuis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brinkhuis/32/18752_2.png) [@Brinkhuis](https://discourse.julialang.org/u/Brinkhuis)\
**Post date:** [May 18, 2022, 6:18am UTC](https://discourse.julialang.org/t/annotated-heatmaps-in-gadfly-do-not-fully-show-the-annotations-in-the-first-and-last-column/81217/2 "2022-05-18T06:18:59Z")

</div>

Commenting out the `Coord.cartesian` line solves the issue.
