I want to specify the position of the text relative to the axis. I tried the following:
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
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?
garrek
December 8, 2022, 12:52am
2
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)?
This was fixed just recently and is now available in >= v0.18.4
MakieOrg:master
← dgleich:transforms-data-only
opened 10:04PM - 22 Nov 22 UTC
# 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.
1 Like