# Relative text position in Makie in log scale

**URL:** <https://discourse.julialang.org/t/relative-text-position-in-makie-in-log-scale/91393>\
**Category:** Visualization\
**Tags:** plotting, makie\
**Created:** [December 7, 2022, 10:41pm UTC](https://discourse.julialang.org/t/relative-text-position-in-makie-in-log-scale/91393 "2022-12-07T22:41:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yhchang96](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yhchang96/32/36499_2.png) [@yhchang96](https://discourse.julialang.org/u/yhchang96)\
**Post date:** [December 7, 2022, 10:41pm UTC](https://discourse.julialang.org/t/relative-text-position-in-makie-in-log-scale/91393/1 "2022-12-07T22:41:59Z")

</div>

I want to specify the position of the text relative to the axis. I tried the following:

```julia
fig = Figure()

ax1 = Axis(fig[1,1], xscale=log10, yscale=log10)
text!(ax1, 0.1, 0.9, text="testing", align=(:left, :top), space=:relative)
limits!(ax1, 0.01, 1, 0.01, 1)

ax2 = Axis(fig[1,2], xminorticksvisible=true, yminorticksvisible=true,
    xminorgridvisible=true, yminorgridvisible=true,
    xminorticks=0.1:0.1:0.9, yminorticks=0.1:0.1:0.9)
text!(ax2, 0.1, 0.9, text="testing", align=(:left, :top), space=:relative)
limits!(ax2, 0, 1, 0, 1)

fig

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/1/011cda6f5101491fa87c1cd84d775088debb6f22.png)

On the right axis, the position of the text is where I want, but for the left axis which is in log scale, the text doesn’t appear in the position I expected (should be the same as the right linear-linear axis). What’s the proper way to specify relative position of the text in loglog plot?

---

<div class="post-metadata">

**Author:** ![garrek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/garrek/32/27937_2.png) [@garrek](https://discourse.julialang.org/u/garrek)\
**Post date:** [December 8, 2022, 12:52am UTC](https://discourse.julialang.org/t/relative-text-position-in-makie-in-log-scale/91393/2 "2022-12-08T00:52:58Z")

</div>

I ran your code as is and it worked for me (“testing” is in the same place for both plots). Are you using the latest version of Makie (0.19.0)?

---

<div class="post-metadata">

**Author:** ![fatteneder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fatteneder/32/33991_2.png) [@fatteneder](https://discourse.julialang.org/u/fatteneder)\
**Post date:** [December 8, 2022, 7:43am UTC](https://discourse.julialang.org/t/relative-text-position-in-makie-in-log-scale/91393/3 "2022-12-08T07:43:13Z")

</div>

This was fixed just recently and is now available in `>= v0.18.4`

> <https://github.com/MakieOrg/Makie.jl/pull/2436>
>
> \# Description
> 
> Fixes #2424 Fixes #2065 
> 
> This PR adjusts the behavior of the… axis/scene transformations to only apply to plots in the :data space. 
> 
> \## Notes
> 
> Examined and editing almost all places where "apply\_transform" was used to switch to the new three parameter version suggested in #2065. 
> 
> There were some places where the existing behavior was left. This is due to a quick survey of the surrounding logic suggesting that the existing code assumes things are transformed. Places where this happens:
> 
> NO CHANGE src/basic\_recipes/hvspan.jl:\_apply\_x\_transform(t::Tuple, v) = apply\_transform(t\[1\], v)
> NO CHANGE src/basic\_recipes/hvspan.jl:\_apply\_y\_transform(t::Tuple, v) = apply\_transform(t\[2\], v)
> NO CHANGE src/layouting/data\_limits.jl: point\_t = apply\_transform(trans\_func, point)
> NO CHANGE src/layouting/data\_limits.jl: (to\_ndim(Point3f, project(model, apply\_transform(trans\_func, point)), 0f0) for point in points)
> NO CHANGE src/makielayout/blocks/axis.jl: tlims = Makie.apply\_transform(t, lims)
> 
> \## Type of change
> 
> \- \[X\] Bug fix (non-breaking change which fixes an issue)
> 
> \## Checklist
> 
> \- \[\] Added an entry in NEWS.md (for new features and breaking changes)
> \- \[\] Added or changed relevant sections in the documentation
> \- \[X\] Added unit tests for new algorithms, conversion methods, etc.
> \- \[\] Added reference image tests for new plotting functions, recipes, visual options, etc.
