Skip to content

Normalization of elevation and azimuth angles for surface plots #10762

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

Closed

Conversation

jinshifen33
Copy link
Contributor

@jinshifen33 jinshifen33 commented Mar 12, 2018

PR Summary

This PR normalizes the input during the initialization of a surface plot in order to make the elevation and azimuth angles consistent throughout the plot.

Issue #10241

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant

@jinshifen33 jinshifen33 changed the title Bugfix for issue 10241 Normalization of elevation and azimuth angles for surface plots Mar 12, 2018
@WeatherGod
Copy link
Member

I need to think on this a bit. The original code intentionally flipped the display upside down, but I haven't a clue why anyone would want that. But, just because I can't think of a reason right now doesn't mean that it isn't supposed to be this way.

@jinshifen33 jinshifen33 reopened this Mar 13, 2018
@jinshifen33
Copy link
Contributor Author

I found a use case, at least, that will make this fix useful.

From https://matplotlib.org/examples/mplot3d/rotate_axes3d_demo.html

With changing Elevation angle from (0-360) as an example.

In the current code base, the rotation will be discontinued at 270(i.e the 3d plot got flipped by 180deg) (see below)

orig

With the fixed code , it will complete one whole rotation(see the gif provided)

fixed

@jinshifen33
Copy link
Contributor Author

jinshifen33 commented Mar 14, 2018

If you are referring to the flipping behaviour of the variable V, then I think it is a normal behaviour. The fix does not attempt to change that, the fix only normalizes the input angle on initialization of the view, to make it consistent throughout the plotting. As you might notice, it is not only the plot got flipped on z-direction 180 degree, the azimuth also got flipped on the original bug report.

else:
self.elev = elev
self.elev = art3d.norm_angle(elev)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're going to normalize it at all, elevation should be normalized to [-90, +90]

Copy link
Contributor Author

@jinshifen33 jinshifen33 Mar 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tacaswell tacaswell added this to the v3.0 milestone Mar 19, 2018
@jinshifen33
Copy link
Contributor Author

hey @WeatherGod , have you made up your mind?

@WeatherGod
Copy link
Member

you know what? That animation convinced me. I'll approve.

@eric-wieser
Copy link
Contributor

This still strikes me as the wrong fix. We should be normalizing it when we render, not when we store - there might be graphs that want to do something clever with the view angles, and expect them to be continuous.

@jinshifen33
Copy link
Contributor Author

it seems to me view_init is a method elevation and azimuth used in rendering.(they have to be stored some where)

if there are need for raw angle operation (non normalized) on elev and azimu, then have it done by implementing getter and setter on these two attributes.

and when start drawing, a call to view_init should normalize the operated angles.

And i dont understand what do you mean by "continuous" ..

@jinshifen33
Copy link
Contributor Author

jinshifen33 commented Apr 24, 2018

@eric-wieser any thought ?

@jklymak jklymak modified the milestones: v3.0, v3.1 Jul 16, 2018
@jklymak
Copy link
Member

jklymak commented Jul 16, 2018

Re milestoning 3.1 as this looks to need more discussion....

@jklymak jklymak modified the milestones: v3.1.0, v3.2.0 Feb 11, 2019
@tacaswell tacaswell modified the milestones: v3.2.0, v3.3.0 Aug 25, 2019
@QuLogic QuLogic modified the milestones: v3.3.0, v3.4.0 Apr 30, 2020
@jklymak jklymak marked this pull request as draft August 24, 2020 14:20
@QuLogic QuLogic removed this from the v3.4.0 milestone Jan 21, 2021
@QuLogic QuLogic added this to the v3.5.0 milestone Jan 21, 2021
@QuLogic QuLogic modified the milestones: v3.5.0, v3.6.0 Aug 23, 2021
@WeatherGod
Copy link
Member

WeatherGod commented Oct 25, 2021 via email

@scottshambaugh
Copy link
Contributor

I've rolled the fix for the original bug into PR #21426, I believe this PR can be closed.

@scottshambaugh
Copy link
Contributor

scottshambaugh commented Dec 3, 2021

#21426 has been merged and so this PR can now be closed @WeatherGod.

@timhoffm timhoffm closed this Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants