mplot3d: scatter (and others) incorrectly auto-scale axes after set_[xyz]lim() #783

Closed
zpincus opened this Issue Mar 21, 2012 · 2 comments

2 participants

@zpincus

The 2d plot functions have some state variables so that if the axes have been manually re-scaled using the set_[xy]lim() functions (or wrappers around them), calling a plot function (like scatter) won't re-scale the axes.

This functionality appears to be missing / inactive in 3d plots:

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

ax = plt.axes(projection='3d')
ax.set_xlim(0,10)
ax.set_ylim(3,7)
ax.set_zlim(-5,15)
ax.scatter([4,5,6],[5,4,6],[6,5,4])
plt.show()

Note that the manually-set limits are no longer respected. Compare to the 2d case, where this works:

import matplotlib.pyplot as plt

ax = plt.axes()
ax.set_xlim(0,10)
ax.set_ylim(3,7)
ax.scatter([4,5,6],[5,4,6])
plt.show()
@WeatherGod WeatherGod was assigned Mar 21, 2012
@WeatherGod
Matplotlib Developers member

Actually, I think I know what is happening here and I might be able to fix this one later tonight.

@WeatherGod
Matplotlib Developers member

This (and other things) are now fixed in PR #1289. It is doubtful it will make it in to the v1.2.0 release, but it will end up in the v1.2.x branch.

@WeatherGod WeatherGod added a commit that closed this issue Dec 3, 2012
@WeatherGod WeatherGod Autoscaling and limits in mplot3d.
    * Fixes improper setting of x,y,z limits not turning off autoscaling
    * Adds units support to z-axis
    * Adds shared axis support for z-axis
    * Closes #783
e76fd7f
@WeatherGod WeatherGod closed this in e76fd7f Dec 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment