# Makie.jl: plot with log-scale axes

**URL:** <https://discourse.julialang.org/t/makie-jl-plot-with-log-scale-axes/40132>\
**Category:** Visualization\
**Tags:** plotting, makie\
**Created:** [May 25, 2020, 2:47pm UTC](https://discourse.julialang.org/t/makie-jl-plot-with-log-scale-axes/40132 "2020-05-25T14:47:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![disberd](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@disberd](https://discourse.julialang.org/u/disberd)\
**Post date:** [May 25, 2020, 2:47pm UTC](https://discourse.julialang.org/t/makie-jl-plot-with-log-scale-axes/40132/1 "2020-05-25T14:47:28Z")

</div>

Is there a way in Makie.jl to have log-scale for the axes in a plot?  
I can’t seem to find any mention about it in the official documentation

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [February 23, 2021, 2:19pm UTC](https://discourse.julialang.org/t/makie-jl-plot-with-log-scale-axes/40132/2 "2021-02-23T14:19:10Z")

</div>

There has been some discussion in [https://github.com/JuliaPlots/Makie.jl/issues/557](https://github.com/JuliaPlots/Makie.jl/issues/557)  
but it is a feature I also sorely miss.

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [May 6, 2021, 1:32pm UTC](https://discourse.julialang.org/t/makie-jl-plot-with-log-scale-axes/40132/3 "2021-05-06T13:32:07Z")

</div>

This is now implemented! See the [documentation for alternative axis scales](https://makie.juliaplots.org/stable/makielayout/axis.html#Log-scales-and-other-axis-scales), presumably coming from the discussion linked to by @vchuravy.

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [September 1, 2021, 8:38am UTC](https://discourse.julialang.org/t/makie-jl-plot-with-log-scale-axes/40132/4 "2021-09-01T08:38:23Z")

</div>

The above doc links doesn’t work anymore. Just for future reference here is the correct link:

[http://makie.juliaplots.org/v0.15.2/examples/layoutables/axis/index.html#log\_scales\_and\_other\_axis\_scales](http://makie.juliaplots.org/v0.15.2/examples/layoutables/axis/index.html#log_scales_and_other_axis_scales)

---

<div class="post-metadata">

**Author:** ![Lilith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lilith/32/27492_2.png) [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Post date:** [June 18, 2022, 8:45pm UTC](https://discourse.julialang.org/t/makie-jl-plot-with-log-scale-axes/40132/5 "2022-06-18T20:45:09Z")

</div>

Now this link: [Axis](https://makie.juliaplots.org/stable/examples/blocks/axis/index.html#log_scales_and_other_axis_scales)

---

<div class="post-metadata">

**Author:** ![rikh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rikh/32/204104_2.png) [@rikh](https://discourse.julialang.org/u/rikh)\
**Post date:** [May 30, 2024, 7:22am UTC](https://discourse.julialang.org/t/makie-jl-plot-with-log-scale-axes/40132/6 "2024-05-30T07:22:25Z")

</div>

To save other people some searching, you can now set `xscale` to some scaling function like `log10`. From the [docs](https://docs.makie.org/v0.21/reference/blocks/axis#xscale):

```julia
using CairoMakie
f = Figure()

for (i, scale) in enumerate([identity, log10, log2, log, sqrt, Makie.logit])
    row, col = fldmod1(i, 2)
    Axis(f[row, col], xscale = scale, title = string(scale),
        xminorticksvisible = true, xminorgridvisible = true,
        xminorticks = IntervalsBetween(5))

    lines!(range(0.01, 0.99, length = 200), 1:200)
end

f

```

 ![afbeelding](https://global.discourse-cdn.com/julialang/original/3X/5/0/50a9a29a85a7599936f67d2eb7c63e804492efe5.png)

---

<div class="post-metadata">

**Author:** ![rikh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rikh/32/204104_2.png) [@rikh](https://discourse.julialang.org/u/rikh)\
**Post date:** [May 30, 2024, 7:49am UTC](https://discourse.julialang.org/t/makie-jl-plot-with-log-scale-axes/40132/7 "2024-05-30T07:49:51Z")

</div>

`yticklabels` can be used to make the axes more readable:

```julia
let
	fig = Figure()

	rate = 1.1
	xs = 1:60
	ys = [100 * rate^x for x in xs]
	yticks = [10 * rate^x for x in xs]

	yticks = [ceil(Int, 10 * 2^i) for i in 1:100]
	yticklabels = ["\$$y" for y in yticks]

	ax = Axis(fig[1, 1]; yscale=log10, yticks=(yticks, yticklabels))
	scatterlines!(ax, xs, ys)

	fig
end

```

 ![afbeelding](https://global.discourse-cdn.com/julialang/original/3X/9/4/94ec7fe3acebc61b2e9ab26e5cd7f34dd0cd4bfd.png)
