Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misplaced yticks when mirroring inside ticks and linking yaxes #2209

Closed
kimauth opened this issue Aug 10, 2022 · 5 comments
Closed

Misplaced yticks when mirroring inside ticks and linking yaxes #2209

kimauth opened this issue Aug 10, 2022 · 5 comments

Comments

@kimauth
Copy link

kimauth commented Aug 10, 2022

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)

misplaced_ticks1

When swapping the linkyaxes! and colgap! commands, the ticks end up in a different position, but still not really correct:
misplaced_ticks2

This is on Makie v0.17.13.

@kimauth
Copy link
Author

kimauth commented Aug 15, 2022

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

misplaced_ticks_contourf

@jkrumbiegel
Copy link
Member

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.

@adityanprasad
Copy link

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...,),)

yticks-bug-linear

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...,),)

yticks-bug-linear-fix

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

@egavazzi
Copy link

egavazzi commented Feb 21, 2024

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 🥳

@jkrumbiegel
Copy link
Member

was fixed in #3581

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

4 participants