Makie.jl
Makie.jl copied to clipboard
Misplaced yticks when mirroring inside ticks and linking yaxes
When using inside mirrored yticks, the right spines ticks seem not to be adjusted correctly upon changes to the yaxis.
set_theme!(Theme(
Axis = (
xticksmirrored = true,
yticksmirrored = true,
xtickalign = 1,
ytickalign = 1,
),
))
f = Figure()
ax_t = Axis(f[1,1])
lines!(ax_t, rand(10))
ax_n = Axis(f[1,2])
lines!(ax_n, rand(10))
# linkyaxes!(ax_n, ax_t)
colgap!(f.layout, 12.)
linkyaxes!(ax_n, ax_t)
When swapping the linkyaxes!
and colgap!
commands, the ticks end up in a different position, but still not really correct:
This is on Makie v0.17.13
.
Here is another example of this, without linking axes this time. It's an example from the docs, I only added the yticksmirrored
option.
using CairoMakie
using DelimitedFiles
volcano = readdlm(Makie.assetpath("volcano.csv"), ',', Float64)
f = Figure()
Axis(f[1, 1]; yticksmirrored=true)
co = contourf!(volcano, levels = 10)
Colorbar(f[1, 2], co)
f
Yes good catch, there were some edits to observable updates with ticks a while ago, those must have broken whatever the mirroring uses. Or the mirroring itself was buggy from the start and just not visible in my specific tests.
I have the same problem, except in addition to being misaligned, my mirrored inner-ticks also end up on the outside. This is without linking any axes.
X = rand(100) .+ 100
f = Figure()
axisargs = (
xticksmirrored=true,
yticksmirrored=true,
xtickalign=1,
ytickalign=1,
)
scatter(f[1,1], X, axis=(;axisargs...,))
scatter(f[1,2], X .* 10, axis=(;axisargs...,),)
scatter(f[2,1], X, axis=(;axisargs...,))
scatter(f[2,2], X .* 10, axis=(;axisargs...,),)
Weirdly enough, this only seems to affect the plot at GridPosition[1,1] if it is created first. If I switch the order of construction, Makie seems to fix itself.
X = rand(100) .+ 100
f = Figure()
axisargs = (
xticksmirrored=true,
yticksmirrored=true,
xtickalign=1,
ytickalign=1,
)
scatter(f[1,2], X .* 10, axis=(;axisargs...,))
scatter(f[1,1], X, axis=(;axisargs...,),)
scatter(f[2,1], X, axis=(;axisargs...,))
scatter(f[2,2], X .* 10, axis=(;axisargs...,),)
Btw, would it be possible to rename xticksmirrored
to xtickmirrored
(i.e. singular instead of plural). xticksmirrored
and xminorticksmirrored
are the only attributes that are plural: compare this to xtickalign
, xtickcolor
xtickformat
etc. The only exception seems to be xticks
, which you could justify because of common usage and the fact that it expects a range of values.
I am using Julia Version 1.8.0-rc3
on an M1 Mac and GLMakie v0.6.13
Soooo, I stumbled over that issue today as I had a similar problem with mirroring ticks... until I found out I was using an old version of Makie (v0.20.3
). Everything works fine (including all examples here) under the latest version (v0.20.7
), so some recent change fixed it 🥳
was fixed in https://github.com/MakieOrg/Makie.jl/pull/3581