title: How can I plot output from a function which returns multiple values in Python?
body: <h2>Short intro</h2>
  
  <p>I'm calculating and plotting spectral energy of planets orbiting pulsar from given data.  </p>
  
  <p>I have previously ordered all data in a list <em>variations</em> with dimensions [172, 2] (172 rows and 2 columns). </p>
  
  <p>Firstly, I have to calculate parameters of a presupposed model and spectral energy accordingly (from those very parameters).</p>
  
  <p>To do that, I defined a function under which I defined the presupposed model and <em>find_fit</em> function which takes the model and variations data.</p>
  
  <h2>Code</h2>
  
  <pre><code> var('a, b, t')
  
  def spectrum(omega):
  
      model = a*sin(omega*t) + b*cos(omega*t)
      fit = find_fit(variations, model, parameters= [a, b], variables = [t], solution_dict = True)
      sp_en = ((fit[a])**2 + (fit[b])**2)/2
  
      return fit[a], fit[b], sp_en
  </code></pre>
  
  <p>Then I call the function and print values:</p>
  
  <pre><code>c, v, energy = spectrum(20)   #enter arbitray angular frequency here
  print "Values for the given angular frequency : \n \n a = %f, b = %f, spectral_energy = %f " % (c, v, energy)
  </code></pre>
  
  <hr>
  
  <p>Now I have to plot  <strong><em>only</em></strong> <strong><em>sp_en</em></strong> output. </p>
  
  <h2>"Semi-solution"</h2>
  
  <p>It is easy to that if a <em>spectrum</em> function return <strong><em>only sp_en</em></strong>. It is sufficient than to write:</p>
  
  <pre><code>var('t')
  plot(spectrum(t), (t, 1, 100))
  </code></pre>
  
  <p>Which returns:
  <a href="http://i.stack.imgur.com/x8QpQ.png" rel="nofollow">energy-omega plot</a></p>
  
  <hr>
  
  <p>The question than is: how do I plot this function if I want to print all three outputs?</p>