擅长:python、mysql、java
<p>我对@paul-H代码做了一些小修改,这样您就可以独立设置x/y轴和图例的字体大小。希望有帮助:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
x = np.random.normal(size=37)
y = np.random.lognormal(size=37)
# defaults
sns.set()
fig, ax = plt.subplots()
ax.plot(x, y, marker='s', linestyle='none', label='small')
ax.legend(loc='upper left', fontsize=20,bbox_to_anchor=(0, 1.1))
ax.set_xlabel('X_axi',fontsize=20);
ax.set_ylabel('Y_axis',fontsize=20);
plt.show()
</code></pre>
<p>这是输出:</p>
<p><a href="https://i.stack.imgur.com/nTcas.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nTcas.png" alt="enter image description here"/></a></p>