Skip to content

Commit 8222469

Browse files
committed
plot_centroids figure return
`CrossSection.plot_centroids()` now returns the plot figure and axes object. Example scripts also updated to reflect this.
1 parent 4d2bdd5 commit 8222469

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

sectionproperties/analysis/cross_section.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,8 @@ def plot_centroids(self, pause=True):
11771177
# finish the plot
11781178
post.finish_plot(ax, pause, title='Centroids')
11791179

1180+
return fig, ax
1181+
11801182
def display_mesh_info(self):
11811183
"""Prints mesh statistics (number of nodes, elements and regions) to the command window.
11821184

sectionproperties/examples/example_composite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
section.display_results()
4545

4646
# plot the centroids
47-
section.plot_centroids()
47+
fig, ax = section.plot_centroids()
4848

4949
stress_post.plot_stress_n_zz(pause=False) # plot the axial stress
5050
stress_post.plot_stress_m_zz(pause=False) # plot the bending stress

sectionproperties/examples/example_custom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@
3333
section.calculate_plastic_properties()
3434

3535
# plot the centroids
36-
section.plot_centroids()
36+
fig, ax = section.plot_centroids()

sectionproperties/examples/example_merged.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@
3939
section.calculate_plastic_properties(time_info=True, verbose=True)
4040

4141
# plot the centroids
42-
section.plot_centroids()
42+
fig, ax = section.plot_centroids()

sectionproperties/examples/example_mirr_rot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@
3333
section.calculate_plastic_properties(time_info=True, verbose=True)
3434

3535
# plot the centroids
36-
section.plot_centroids()
36+
fig, ax = section.plot_centroids()

0 commit comments

Comments
 (0)