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

Missing line segments in PolarAxis #3927

Closed
pzabka opened this issue Jun 4, 2024 · 6 comments
Closed

Missing line segments in PolarAxis #3927

pzabka opened this issue Jun 4, 2024 · 6 comments
Labels
bug PolarAxis transformation related to `Transformation` objects

Comments

@pzabka
Copy link

pzabka commented Jun 4, 2024

When creating lines in PolarAxis, some line segments (around r=0 or theta=2pi) are missing.

MWE:

k = 50
fig = Figure()
ax = PolarAxis(fig[1, 1]; radius_at_origin=0)
lines!(ax, 0:pi/k:2*pi, cos; linewidth=5)
fig

It should be a full circle, but I got this instead:

fig1_bug

When changing the parametr k, the effect may vary.

Tested with:
GLMakie v0.10.0 (Makie v0.21.0, Makiecore v0.8.0)
CairoMakie v0.12.0 (Makie v0.21.0, Makiecore v0.8.0)
GLMakie v0.9.10 (Makie v0.20.9, MakieCore v0.7.3)
CairoMakie v0.11.10 (Makie v0.20.9, MakieCore v0.7.3)

@pzabka pzabka added the bug label Jun 4, 2024
@ffreyer
Copy link
Collaborator

ffreyer commented Jun 4, 2024

The gap at r = 0 happens because by default PolarAxis removes points with negative radius. You can turn that off by setting clip_r = false.
The gap at r = 1 happens because the range doesn't include 2pi. With clip_r = false you end up drawing the circle twice you won't see the missing r = 1 section anymore.

@asinghvi17
Copy link
Member

Should we clamp r to zero instead of clipping by default? Seems like that would be less surprising.

@jkrumbiegel
Copy link
Member

I'm wondering why r = 0 is a negative radius

@ffreyer
Copy link
Collaborator

ffreyer commented Jun 5, 2024

It's not

if trans.clip_r && (r < 0.0)
return Point2{T}(NaN)
end

It's just that the next point in the line is at a negative radius.

I think regardless of what we do by default it's going to have some downsides.

  • r = max(0, r) modifies user data
  • NaN removes data and can lead to missing pieces like here
  • keeping r < 0 shows data that in some contexts is invalid and it may not be intuitive where that data ends up

Related:
#3381
#3375

@pzabka
Copy link
Author

pzabka commented Jun 5, 2024

Thank you for a great explanation.

Out of curiosity, I have tried Plots.jl and Matlab and in both cases the default behaviour is radius_at_origin=0, clip_r = false However, I agree that such a result is quite misleading, and the current Makie behaviour feels better. It is just confusing that the line is not going to r=0, leaving the plot area.

@ffreyer ffreyer added transformation related to `Transformation` objects PolarAxis labels Aug 28, 2024
@ffreyer
Copy link
Collaborator

ffreyer commented Aug 28, 2024

Closing this as not-planned. (Unless this becomes a common complaint)

@ffreyer ffreyer closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug PolarAxis transformation related to `Transformation` objects
Projects
None yet
Development

No branches or pull requests

4 participants