Skip to content

Commit

Permalink
Fix matplotlib error for axis equals
Browse files Browse the repository at this point in the history
"NotImplementedError: Axes3D currently only supports the aspect argument 'auto'. You passed in 'equal'."
  • Loading branch information
goldbattle committed Aug 8, 2022
1 parent 5d65763 commit ae12925
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def setupFigure(self):
#interactive mode
pl.ion()
#hack to enforce axis equal (matplotlib doesn't support that)
self.ax.set_aspect('equal')
#self.ax.set_aspect('equal')
MAX = 1
for direction in (-1, 1):
for point in np.diag(direction * MAX * np.array([1,1,1])):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def set_axis_equal_3d(ax):
r = maxsize / 2
for ctr, dim in zip(centers, 'xyz'):
getattr(ax, 'set_{}lim'.format(dim))(ctr - r, ctr + r)
ax.set_aspect('equal')
ax.set_xlim(centers[0]-maxsize, centers[0]+maxsize)
ax.set_ylim(centers[1]-maxsize, centers[1]+maxsize)
ax.set_zlim(centers[2]-maxsize, centers[2]+maxsize)


def set_orthogonal_projection(zfront, zback):
Expand Down

0 comments on commit ae12925

Please sign in to comment.