擅长:python、mysql、java
<p>。。。或使用受约束的布局:</p>
<pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
import numpy as np
data = np.random.random(size=100)
f, a = plt.subplots(2, 2, figsize=(10, 5), constrained_layout=True)
a[0,0].plot(data)
a[0,0].set_title("this is a really long title\n"*2)
a[0,1].plot(data)
a[1,1].plot(data)
plt.suptitle("a big long suptitle that runs into the title\n"*2);
</code></pre>
<p><a href="https://i.stack.imgur.com/Xuapv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xuapv.png" alt="enter image description here"/></a></p>