title: NameError: name 'plt' is not defined
body: <p>I'm using Python 3.8.1 on MacOS Catalina. </p>
  
  <p>I installed matplotlib through Terminal, and then in the Python shell I imported it with the following code:</p>
  
  <pre class="lang-none prettyprint-override"><code>&gt;&gt;&gt; import matplotlib
  
  &gt;&gt;&gt; import matplotlib.pyplot as plt
  </code></pre>
  
  <p>I initially just did the second line, but thought I'd try the first one too. Either way, no error messages so assumed that I can now use pyplot.</p>
  
  <p>Then I entered this code and ran the module:</p>
  
  <pre><code>X = [[6], [8], [10], [14], [18]]
  y = [[7], [9], [13], [17.5], [18]]
  plt.figure()
  plt.title('Pizza price plotted against diameter')
  plt.xlabel('Diameter in inches')
  plt.ylabel('Price in dollars')
  plt.plot(X, y, 'k.')
  plt.axis([0, 25, 0, 25])
  plt.grid(True)
  plt.show()
  </code></pre>
  
  <p>But I get this error message:</p>
  
  <pre class="lang-none prettyprint-override"><code>Traceback (most recent call last):
    File "&lt;pyshell#12&gt;", line 1, in &lt;module&gt;
      plt.figure()
  NameError: name 'plt' is not defined
  </code></pre>
  
  <p>Does anybody know why?</p>