title: What is the pure Python equivalent to the IPython magic function call %matplotlib inline?
body: <p>In IPython Notebook, I defined a function that contains a call to the magic function <code>%matplotlib</code>, like this:</p>
  
  <pre><code>def foo(x):
      %matplotlib inline
      # ... some useful stuff happens in between here
      imshow(np.asarray(img))
  </code></pre>
  
  <p>I'd like to put that function into a Python module so that I can just import and call it. </p>
  
  <p>However, to do this, I'd need to remove the <code>%matplotlib inline</code> from my code and replace it with its pure-Python equivalent. </p>
  
  <p>What is the pure-Python equivalent?</p>