fig.text(0.6, 0.15,
'Line 1\n'
'Line 2\n'
'Line 3')
In matplotlib is there a way to increase line spacing between 2 lines in the command above? I tried inserting an extra \n
but that makes the line separation too wide.
With each .text()
statement, optional parameter linespacing
will set the vertical line spacing equal to the multiple values of the font size.
For example,
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
for ea in range(5):
fig.text(0.18 + 0.15*ea, 0.15,
'Line 1\n'
'Line 2\n'
'Line 3', color='b', \
linespacing = 1+ea)
plt.show()
The resulting plot is:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With