MakieOrg / GeoMakie.jl

Geographical plotting utilities for Makie.jl
https://geo.makie.org
MIT License
167 stars 24 forks source link

fix: xticklabelpad applied in wrong direction #138

Closed haakon-e closed 1 year ago

haakon-e commented 1 year ago

fix xticklabelpad being applied in x-direction, not y-direction.

With the code provided in #137, I now get the output:

image

In bottom-left figure, xlabels are no longer overlapping with bottom spine. In bottom-right figure, xlabels are shifted down, as expected, but there seem to be some leftward shift resulting in slightly overlapping x-ticks. Unfortunately, this does not fix the top-right figure, where xlabel ticks are still missing.


This PR also fixes an issue where, if xticklabelpad=0,

julia> fig = Figure()

julia> ga = GeoAxis(fig[1,1]; coastlines = true, dest = "+proj=longlat", xticklabelpad=0);

I would get this output:

image

but, with this PR, I get:

image

This is because we would divide by zero in directional_pad, resulting in NaN positioning of ticks.


I wouldn't claim this closes #137, since I'd still like for lonticks to appear in the top-right plot, but it's a step in the right direction.

asinghvi17 commented 1 year ago

Thanks for the PR! I'll try to merge it later tonight. I do need to go through and recheck my math on this one - what's happening now is still somewhat wrong to me even after your patch, but that's probably fundamental to how I wrote this. (You might notice that the ticks are not all aligned the same even in the longlat projection).