Skip to content

Commit

Permalink
Fix plot_wing.py to work for matplotlib v3.8+ (#425)
Browse files Browse the repository at this point in the history
* Remove the use of the dist attribute for 3-D plots, which has been
    deprecated in the recent matplotlib versions.
  * Make the 3-D view behavior consitent in plot_wingbox.py, i.e., the
    view does not reset if the iteration is changed.
  • Loading branch information
shamsheersc19 authored Mar 11, 2024
1 parent a8a272a commit e1cb181
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 0 additions & 2 deletions openaerostruct/utils/plot_wing.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ def plot_wing(self):
self.ax.cla()
az = self.ax.azim
el = self.ax.elev
dist = self.ax.dist

for j, name in enumerate(self.names):
mesh0 = self.mesh[self.curr_pos * n_names + j].copy()
Expand Down Expand Up @@ -577,7 +576,6 @@ def plot_wing(self):
self.ax.text2D(0.15, 0.05, self.obj_key + ": {}".format(obj_val), transform=self.ax.transAxes, color="k")

self.ax.view_init(elev=el, azim=az) # Reproduce view
self.ax.dist = dist

def save_video(self):
options = dict(title="Movie", artist="Matplotlib")
Expand Down
4 changes: 3 additions & 1 deletion openaerostruct/utils/plot_wingbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,8 @@ def plot_sides(self):
def plot_wing(self):
n_names = len(self.names)
self.ax.cla()
az = self.ax.azim
el = self.ax.elev

for j, name in enumerate(self.names):
# for wingbox viz
Expand Down Expand Up @@ -755,7 +757,7 @@ def plot_wing(self):
color="k",
)

self.ax.view_init() # Reproduce view
self.ax.view_init(elev=el, azim=az) # Reproduce view

def save_video(self):
options = dict(title="Movie", artist="Matplotlib")
Expand Down

0 comments on commit e1cb181

Please sign in to comment.