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

ilabels not inside nodes in 3D #192

Open
kockahonza opened this issue Oct 7, 2024 · 3 comments
Open

ilabels not inside nodes in 3D #192

kockahonza opened this issue Oct 7, 2024 · 3 comments

Comments

@kockahonza
Copy link

Pretty much as the title says, when I try to use ilabels in 3D layouts the graph works and I do get labels but they're seemingly all offset by a large amount in the z direction. Maybe I'm just not using something correctly but it at least looks like a bug, I'm attaching an image with the resulting plot.

Example plot

@hexaeder
Copy link
Collaborator

hexaeder commented Oct 7, 2024

Ah yes, the problem is the following: the text plot is drawn before the scatter plot, because the scatter plot markersize depends on the glyph size of the ilabels. Since the node plot is defined later, its markers would overdraw the labels. To circumvent this, we translate the ilabels plot +1 in z direction

translate!(ilabels_plot, 0, 0, 1)

which is essentially taken from the docs. Not a problem in 2d but quite the problem in 3d...
So we need a better way of reordering the plots without actually touching the z coordinate.

@asinghvi17
Copy link
Member

Hmm, maybe define a depth_shift? But that might not work in Cairo...would have to investigate. FerriteViz.jl does this.

@hexaeder
Copy link
Collaborator

hexaeder commented Oct 7, 2024

depth_shift does not seem to affect different 2d billboards within the same plane, see below example... maybe its possible to reorder the the plots array at the end of the recipe?

using Pkg
pkg"activate --temp"
pkg"add GLMakie"
using GLMakie

pos = Point3{Float32}[(0,0,0),(1,0,0),(0,1,0),(0,0,1)]
labels = ["o", "x", "y", "z"]

fig = Figure()
ax = LScene(fig[1,1])
text!(ax, pos; text=labels, align=(:center,:center), depth_shift=1)
scatter!(ax, pos; markersize=50, depth_shift=-1)

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

3 participants