# Using same x- and y-axis scales in Makie plots

**URL:** https://discourse.julialang.org/t/using-same-x-and-y-axis-scales-in-makie-plots/58173
**Category:** Visualization
**Tags:** makie
**Created:** [March 29, 2021, 5:10pm UTC](https://discourse.julialang.org/t/using-same-x-and-y-axis-scales-in-makie-plots/58173 "2021-03-29T17:10:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![wsshin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsshin/32/360_2.png) [@wsshin](https://discourse.julialang.org/u/wsshin)
#### Post date: [March 29, 2021, 5:10pm UTC](https://discourse.julialang.org/t/using-same-x-and-y-axis-scales-in-makie-plots/58173/1 "2021-03-29T17:10:29Z")

</div>

What is the simplest way to use the same scales in the x- and y-axis of the plots generated by `Makie`? For example, when visualizing a 5×3 array with `heatmap()` as

```julia
using GLMakie
heatmap(rand(5,3))

```

I want the individual array entries to be shown as the same squares rather than elongated rectangles, such that the ratio between the x- and y-axis lengths is 5:3 on the screen for the above example.

I tried things like `heatmap(rand(3,3), aspect=1)` but it didn’t work. [This section](http://makie.juliaplots.org/stable/makielayout/axis.html#Controlling-Axis-aspect-ratios) in the documentation seems relevant, but the examples there are a bit convoluted; I failed to create a working example that is suffciently short.

---

<div class="post-metadata">

### Author: ![wsshin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsshin/32/360_2.png) [@wsshin](https://discourse.julialang.org/u/wsshin)
#### Post date: [March 29, 2021, 5:34pm UTC](https://discourse.julialang.org/t/using-same-x-and-y-axis-scales-in-makie-plots/58173/2 "2021-03-29T17:34:55Z")

</div>

I’ve figured it out. The following code seems working:

```julia
f = Figure()
ax = Axis(f, aspect=DataAspect())
heatmap!(ax, rand(5,3))

```

The key thing is to use `heatmap!()` rather than `heatmap()` in order to draw on the axis that is correctly set up.

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [March 29, 2021, 5:52pm UTC](https://discourse.julialang.org/t/using-same-x-and-y-axis-scales-in-makie-plots/58173/3 "2021-03-29T17:52:33Z")

</div>

You can also do `heatmap(args..., axis = (aspect = DataAspect(),))` to do it in one go

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [March 29, 2021, 7:02pm UTC](https://discourse.julialang.org/t/using-same-x-and-y-axis-scales-in-makie-plots/58173/4 "2021-03-29T19:02:12Z")

</div>

The syntax is explained here in more detail [http://makie.juliaplots.org/stable/plot\_method\_signatures.html#Special-Keyword-Arguments](http://makie.juliaplots.org/stable/plot_method_signatures.html#Special-Keyword-Arguments)
