Skip to main content
Added function link
Source Link
Trenton McKinney
  • 63.2k
  • 41
  • 169
  • 212

I usually care more about the relative sizes of height/width rather than the actual values in inches. So, I use plt.figaspect()plt.figaspect() to set the aspect ratio.

# Make the image 3x as wide as it is tall
fix, ax = plt.subplots(figsize=plt.figaspect(1/3))
plt.title("I'm 3x as wide as I am tall")
plt.show()

enter image description here

I usually care more about the relative sizes of height/width rather than the actual values in inches. So, I use plt.figaspect() to set the aspect ratio.

# Make the image 3x as wide as it is tall
fix, ax = plt.subplots(figsize=plt.figaspect(1/3))
plt.title("I'm 3x as wide as I am tall")
plt.show()

enter image description here

I usually care more about the relative sizes of height/width rather than the actual values in inches. So, I use plt.figaspect() to set the aspect ratio.

# Make the image 3x as wide as it is tall
fix, ax = plt.subplots(figsize=plt.figaspect(1/3))
plt.title("I'm 3x as wide as I am tall")
plt.show()

enter image description here

Source Link
codeananda
  • 1.4k
  • 2
  • 19
  • 27

I usually care more about the relative sizes of height/width rather than the actual values in inches. So, I use plt.figaspect() to set the aspect ratio.

# Make the image 3x as wide as it is tall
fix, ax = plt.subplots(figsize=plt.figaspect(1/3))
plt.title("I'm 3x as wide as I am tall")
plt.show()

enter image description here