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

DataInspector for PolarAxis should display tuples of (r, theta) #4446

Open
thomvet opened this issue Oct 3, 2024 · 6 comments
Open

DataInspector for PolarAxis should display tuples of (r, theta) #4446

thomvet opened this issue Oct 3, 2024 · 6 comments
Labels
DataInspector enhancement Feature requests and enhancements PolarAxis transformation related to `Transformation` objects

Comments

@thomvet
Copy link
Contributor

thomvet commented Oct 3, 2024

Feature description

It would be nice if DataInspector() shows tuples of (r, theta) instead of (x,y,z) for a PolarAxis.

Consider the following example:

f = Figure(size = (800, 400))

ax = PolarAxis(f[1, 1], title = "Theta as x")
lineobject = lines!(ax, 0..2pi, sin, color = :red)

ax = PolarAxis(f[1, 2], title = "R as x", theta_as_x = false)
scatobject = scatter!(range(0, 10, length=100), cos, color = :orange)
DataInspector()

image

Also, the (r = 0, theta = 0) point is shown as (x = 0, y = 1, z = 0). That's confusing? 🙂

@thomvet thomvet added the enhancement Feature requests and enhancements label Oct 3, 2024
@ffreyer ffreyer added DataInspector PolarAxis transformation related to `Transformation` objects labels Oct 9, 2024
@EdsterG
Copy link
Contributor

EdsterG commented Oct 14, 2024

It seems like the data inspector isn't aware of the underlying Axis the plot is displayed on. Am I missing something @ffreyer, or is there an easy way to access the axis object from show_data? Would be even better if it was accessible from the inspector_label function, but when I tried plot didn't seem to have any references to the axis.

@asinghvi17
Copy link
Member

The scene tree (and DataInspector by extension) is unaware of any axis or layout related things.

However, the scene's transformation should be a Makie.PolarTransformation or Makie.PolarAxisTransformation (I don't remember the exact name, but it's something along those lines), which you could check via scene.transformation.transform_func[] or plot.transformation.transform_func[].

@EdsterG
Copy link
Contributor

EdsterG commented Oct 15, 2024

Does those transformation functions somehow hint at the value of theta_as_x? That's the tricky part, getting the value of theta_as_x.

@asinghvi17
Copy link
Member

Isn't that embedded into the transformation struct?

@asinghvi17
Copy link
Member

struct Polar
theta_as_x::Bool
clip_r::Bool
theta_0::Float64
direction::Int
r0::Float64
function Polar(theta_0::Real = 0.0, direction::Int = +1, r0::Real = 0, theta_as_x::Bool = true, clip_r::Bool = true)
return new(theta_as_x, clip_r, theta_0, direction, r0)
end
end

@EdsterG
Copy link
Contributor

EdsterG commented Oct 15, 2024

Oh, thanks for pointing this out. I wasn't too familiar with how polar axis are implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DataInspector enhancement Feature requests and enhancements PolarAxis transformation related to `Transformation` objects
Projects
None yet
Development

No branches or pull requests

4 participants