擅长:python、mysql、java
<p>因为一些人(比如我)可能仍然对pylab的使用感到困惑,因为使用<code>pylab</code>的例子已经在互联网上出现了,这里引用了matplotlib官方常见问题解答:</p>
<blockquote>
<p>pylab is a convenience module that bulk imports matplotlib.pyplot (for plotting) and numpy (for mathematics and working with arrays) in a single name space. Although many examples use pylab, it is no longer recommended.</p>
</blockquote>
<p>所以,TL;DR;是不用pylab,句号。根据需要分别使用<code>pyplot</code>和导入<code>numpy</code>。</p>
<p><a href="https://matplotlib.org/faq/usage_faq.html#matplotlib-pyplot-and-pylab-how-are-they-related" rel="nofollow noreferrer">Here is the link</a>以供进一步阅读和其他有用的示例。</p>