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

Axis ticks/limits are not constrained by axis.limits #231

Open
asinghvi17 opened this issue Jun 7, 2024 · 1 comment
Open

Axis ticks/limits are not constrained by axis.limits #231

asinghvi17 opened this issue Jun 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@asinghvi17
Copy link
Member

Consider the following:

	
fig = Figure(size=(1500, 1500))

settings = "+proj=leac +lat_1=45.0 +ellps=sphere "

ga = GeoAxis(
	fig[1, 1];
	dest=settings,
	title=settings,
)
lines!(ga, GeoMakie.coastlines())
ylims!(ga, 0, 90)
fig

download
The screen limits are technically correct, but the ticks range further out which is not great.

@asinghvi17 asinghvi17 added the bug Something isn't working label Jun 7, 2024
@asinghvi17
Copy link
Member Author

asinghvi17 commented Jun 18, 2024

The relevant code is here:

GeoMakie.jl/src/geoaxis.jl

Lines 579 to 603 in b7c0fdd

limit_rect = Makie.to_value(axis.finallimits)
trans_inverse = Makie.to_value(transform_ticks_inv_obs)
limits_t = Makie.apply_transform(trans_inverse, limit_rect)
xlims = Makie.xlimits(limits_t)
ylims = Makie.ylimits(limits_t)
xticks = user_xticks isa Makie.Automatic ? geoticks(-180, 180, xlims...) : Makie.get_tickvalues(user_xticks, xlims...)
yticks = user_yticks isa Makie.Automatic ? geoticks(-90, 90, ylims...) : Makie.get_tickvalues(user_yticks, ylims...)
spines = spines_obs[]
foreach(empty!, [spines.left, spines.right, spines.bottom, spines.top])
for lon in xticks
range = LinRange(yticks[1], yticks[end], 100)
project_tick_points!(lon_transformed, trans, trans_inverse, range, lon, 1, limit_rect, spines.bottom, spines.top)
end
for lat in yticks
range = LinRange(xticks[1], xticks[end], 100)
project_tick_points!(lat_transformed, trans, trans_inverse, range, lat, 2, limit_rect,
spines.left, spines.right)
end
lonticks_line_obs[] = lon_transformed
latticks_line_obs[] = lat_transformed
notify(spines_obs)

basically, the limits being used are finallimits which works great for zooming, but doesn't take the axis's set limits into account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant