3

I am using VS 2013 Express version with python tools and canopy installed (python 2.7).

I am trying to plot a simple function when I run the code and it doesn't work:

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab

plt.plot(np.random.rand(1000).cumsum())

I'm using interactive mode as IPython and when I execute the above in the command prompt, I see the plot.

The only difference between this plot on the cmd and in VS 2013 is the --pylab option I use when I load IPython on the commands prompt. When I tries to add --pylab and an Interpreter Options (Tools --> Setting --> Python Tools --> Interactive Windows).

anyone knows how I can get actual matplotlib plots when I run my python code on Visual Studio ?

Thanks for your help.

MoneyTime
  • 33
  • 1
  • 3

1 Answers1

7

You need to type plt.show()

pylab mode makes this unnecessary.

http://matplotlib.org/faq/usage_faq.html#matplotlib-pyplot-and-pylab-how-are-they-related

Jonathan March
  • 5,800
  • 2
  • 14
  • 16