Skip to content

Commit

Permalink
replace rc bbox_inches with tight_layout
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Aug 6, 2023
1 parent e62a722 commit 0f1b23f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions docs/source/sphinx_gallery/geometry/plot_ellipse.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def breakdown():
b = 1
x1 = 0.7

plt.figure(figsize=(14, 6))
fig = plt.figure(figsize=(14, 6))
ellipse = msp.geometry.Ellipse(a=a, b=b)
approx = ellipse.approximate(x1)
ellipse.plot(edgecolor='k', facecolor='none', lw=3)
Expand All @@ -34,8 +34,9 @@ def breakdown():
plt.gca().set_xticklabels([str(round(float(label), 1)) for label in xticks])
plt.axis('scaled')
plt.grid(True, linestyle=':')
fig.tight_layout()


if __name__ == '__main__':
plt.rc('savefig', dpi=300, bbox_inches='tight', pad_inches=0)
plt.rc('savefig', dpi=300, pad_inches=0)
main()
5 changes: 3 additions & 2 deletions docs/source/sphinx_gallery/geometry/plot_rectangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def breakdown(length, width, x1, figsize):
approx = r.approximate(x1=x1)

# Plot rectangle
plt.figure(figsize=figsize)
fig = plt.figure(figsize=figsize)
r.plot(edgecolor='k', facecolor='none', lw=3)

# Plot breakdown
Expand All @@ -38,8 +38,9 @@ def breakdown(length, width, x1, figsize):

plt.axis('scaled')
plt.grid(True, linestyle=':')
fig.tight_layout()


if __name__ == '__main__':
plt.rc('savefig', dpi=300, bbox_inches='tight', pad_inches=0)
plt.rc('savefig', dpi=300, pad_inches=0)
main()

0 comments on commit 0f1b23f

Please sign in to comment.