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

colgap and rowgap behave weirdly after creating an inset axis #2975

Closed
thudjx opened this issue May 23, 2023 · 1 comment
Closed

colgap and rowgap behave weirdly after creating an inset axis #2975

thudjx opened this issue May 23, 2023 · 1 comment

Comments

@thudjx
Copy link

thudjx commented May 23, 2023

The MWE goes like:

let
	fig = Figure()
	ax1 = Axis(fig[1,1], xaxisposition=:top)
	ax2 = Axis(fig[2,1])
	inset_box = Axis(fig[1,1], width=Relative(0.4), height=Relative(0.2), halign=0.45, valign=0.25)
	rowgap!(fig.layout, 0)
	fig
end

The rowgap! is not working correctly:
image
However, if we change the line creating the inset_box into:

inset_box = Axis(fig[2,1], width=Relative(0.4), height=Relative(0.2), halign=0.45, valign=0.25)

everythings go back to normal:
image
The same issue comes with colgap and the MWE is here:

let
	fig = Figure()
	ax1 = Axis(fig[1,1])
	ax2 = Axis(fig[1,2], yaxisposition=:right)
	inset_box = Axis(fig[1,1], width=Relative(0.4), height=Relative(0.2), halign=0.45, valign=0.25)
	colgap!(fig.layout, 0)
	fig
end

The inset_box created this way works correctly but this does not:

inset_box = Axis(fig[1,2], width=Relative(0.4), height=Relative(0.2), halign=0.45, valign=0.25)
@thudjx thudjx changed the title colgap and rowgap behaves weirdly after creating an inset axis colgap and rowgap behave weirdly after creating an inset axis May 23, 2023
@jkrumbiegel
Copy link
Member

jkrumbiegel commented May 23, 2023

This just looks like rowgap doesn't work, but the actual effect is that you reduce the width/height of the additional axis, but its lower protrusions still causes that space to be reserved. This is because it requests the maximum amount of space needed, not the one currently needed (as it depends on the overall space available and thus changes when the layout is recomputed). You can probably set inset.alignmode = Outside(0) so it doesn't have protrusions. In the future, there will probably be more convenient functions added to create inset axes that avoid this.

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

No branches or pull requests

2 participants