You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Axes3D.view_init elevation issue between 270 and 360 degrees #10241
I want to make rotate a 3D plot using the view_init method. If the azim argument is used it makes a smooth rotation around the z-axis. However, if the elev argument is used the plot is flipped after the angle 270 degrees. This problem seems to come from the fact that the range [0:-90] does not give the same output as the range [270:360] while it should. Here are two outputs that should be the same for -15 and 345, but there are not.
Code for reproduction
importmatplotlib.pyplotaspltfrommatplotlibimportcmfrommpl_toolkits.mplot3dimportaxes3dfrompylabimport*elevation=345#or -15angle=Nonefig=plt.figure()
ax=fig.add_subplot(111, projection='3d')
X, Y, Z=axes3d.get_test_data(0.05)
s=ax.plot_surface(X, Y, Z, cmap=cm.jet)
ax.view_init(elev=elevation, azim=angle)
plt.axis('off')
Hmmm, looks like this is on purpose?
```
if abs(relev) > np.pi/2:
# upside down
V = np.array((0, 0, -1))
else:
V = np.array((0, 0, 1))
```
Haven't a clue why, though.
On Fri, Jan 12, 2018 at 10:56 PM, amichaut ***@***.***> wrote:
Bug report
*Bug summary*
I want to make rotate a 3D plot using view_initmethod. If the azim
argument is used it makes a smooth rotation around the z-axis. However, if
the elev argument is used the plot is flipped after the angle 270
degrees. This problem seems to come from the fact that the range [0:-90]
does not give the same output than the range [270:360] while it should.
Here are two outputs than should be the same for -15 and 345, but there are
not.
[image: 345]
<https://user-images.githubusercontent.com/11176618/34902501-af08c20a-f7ea-11e7-9326-42e4e0f8eb27.png>
[image: -15]
<https://user-images.githubusercontent.com/11176618/34902502-af18b994-f7ea-11e7-8d0f-971215223621.png>
*Code for reproduction*
import matplotlib.pyplot as pltfrom matplotlib import cmfrom mpl_toolkits.mplot3d import axes3dfrom pylab import *
elevation=345 #or -15
angle=None
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
X, Y, Z = axes3d.get_test_data(0.05)
s = ax.plot_surface(X, Y, Z, cmap=cm.jet)
ax.view_init(elev = elevation, azim=angle)
plt.axis('off')
*Matplotlib version*
- Operating system: Debian
- Matplotlib version: 2.1
- Matplotlib backend:TkAgg
- Python version: 2.7
Installed from pip
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#10241>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AARy-AHMxKMagp0yieTfiznZ7YUBZY3Xks5tKClfgaJpZM4RdF2U>
.
On Sat, Jan 13, 2018 at 9:13 PM, Benjamin Root ***@***.***> wrote:
Hmmm, looks like this is on purpose?
```
if abs(relev) > np.pi/2:
# upside down
V = np.array((0, 0, -1))
else:
V = np.array((0, 0, 1))
```
Haven't a clue why, though.
On Fri, Jan 12, 2018 at 10:56 PM, amichaut ***@***.***>
wrote:
> Bug report
>
> *Bug summary*
>
> I want to make rotate a 3D plot using view_initmethod. If the azim
> argument is used it makes a smooth rotation around the z-axis. However, if
> the elev argument is used the plot is flipped after the angle 270
> degrees. This problem seems to come from the fact that the range [0:-90]
> does not give the same output than the range [270:360] while it should.
> Here are two outputs than should be the same for -15 and 345, but there are
> not.
>
> [image: 345]
> <https://user-images.githubusercontent.com/11176618/34902501-af08c20a-f7ea-11e7-9326-42e4e0f8eb27.png>
> [image: -15]
> <https://user-images.githubusercontent.com/11176618/34902502-af18b994-f7ea-11e7-8d0f-971215223621.png>
>
> *Code for reproduction*
>
> import matplotlib.pyplot as pltfrom matplotlib import cmfrom mpl_toolkits.mplot3d import axes3dfrom pylab import *
>
> elevation=345 #or -15
> angle=None
>
> fig = plt.figure()
> ax = fig.add_subplot(111, projection='3d')
> X, Y, Z = axes3d.get_test_data(0.05)
> s = ax.plot_surface(X, Y, Z, cmap=cm.jet)
> ax.view_init(elev = elevation, azim=angle)
> plt.axis('off')
>
> *Matplotlib version*
>
> - Operating system: Debian
> - Matplotlib version: 2.1
> - Matplotlib backend:TkAgg
> - Python version: 2.7
>
> Installed from pip
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#10241>, or mute the
> thread
> <https://github.com/notifications/unsubscribe-auth/AARy-AHMxKMagp0yieTfiznZ7YUBZY3Xks5tKClfgaJpZM4RdF2U>
> .
>
Activity
WeatherGod commentedon Jan 14, 2018
WeatherGod commentedon Jan 14, 2018
scottshambaugh commentedon Dec 3, 2021
This was fixed with #21426 and can be closed.