# (Plots.jl) Aspect ratio for log-log plots

**URL:** https://discourse.julialang.org/t/plots-jl-aspect-ratio-for-log-log-plots/110216
**Category:** Visualization
**Tags:** question, plots
**Created:** [February 14, 2024, 5:45pm UTC](https://discourse.julialang.org/t/plots-jl-aspect-ratio-for-log-log-plots/110216 "2024-02-14T17:45:55Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dpt](https://avatars.discourse-cdn.com/v4/letter/d/77aa72/32.png) [@dpt](https://discourse.julialang.org/u/dpt)
#### Post date: [February 14, 2024, 5:45pm UTC](https://discourse.julialang.org/t/plots-jl-aspect-ratio-for-log-log-plots/110216/1 "2024-02-14T17:45:55Z")

</div>

It seems that Plots.jl doesn’t respect aspect\_ratio=1.0 for log-log plots. This is particularly annoying since particular slopes have meaning in such plots (order of polynomial growth). I saw this mentioned in passing in an earlier post:

> [@Arrows not working on log-log plot (GR)](https://discourse.julialang.org/t/arrows-not-working-on-log-log-plot-gr/61454/2):
>
> It looks like an ugly bug. Herein a workaround for loglog plots with aspect ratio = 1. NB: edited code as there seems to be another bug, with aspect\_ratio not being respected in loglog plots if range of xlims != ylims using Plots; gr(legend=false) # Define some input data: x, y = 0.1, 0.1 # vector origin u, v = 9.9, 99.9 # vector xl, yl = (0.01, 100), (0.01, 200) # loglog plot limits (have to be modified to max range) # plot arrowheads as rotated unicode characters (OK for r…

_(Edit: Made the link more precise; it’s not the focus of the post, but mentions the issue in passing.)_

Does anyone have a workaround?

---

<div class="post-metadata">

### Author: ![putianyi888](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/putianyi888/32/32279_2.png) [@putianyi888](https://discourse.julialang.org/u/putianyi888)
#### Post date: [February 14, 2024, 6:33pm UTC](https://discourse.julialang.org/t/plots-jl-aspect-ratio-for-log-log-plots/110216/2 "2024-02-14T18:33:07Z")

</div>

A naive workaround for a static plot (that you don’t often change) is to use the keyword `xticks` and `yticks` to manually choose and format the tick labels. Then you plot the logarithm values on the default scale, with `aspect_ratio=1.0`.

PS. Please file an issue at Plots.jl at your convenience.

---

<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: [February 14, 2024, 7:04pm UTC](https://discourse.julialang.org/t/plots-jl-aspect-ratio-for-log-log-plots/110216/3 "2024-02-14T19:04:40Z")

</div>

One workaround (for the MWE below) is to give a hand to Plots.jl in defining the plot limits:

```julia
using Plots
x = 10 .^(0:9)
y = x .^2
z0, z1 = extrema([x; y])
plot(x, y, axis=:log, ratio=1, lims=(z0,z1))

```
