I’m trying out IPython. I’m also playing around with machine learning which means I need some simple data visualization, so I’m playing around with matplotlib. Here’s how to display generated plots inline (as opposed to in a popup window); the docs are inconsistent.
QT: ipython qtconsole –matplotlib inline
Notebook: launch with “ipython notebook”, then run “%matplotlib inline” in a notebook.
Here’s a sample program that generates and shows a plot:
from matplotlib import pyplot as plt years = range(1950, 2020, 10) gdp = [300, 543, 1075, 2862, 5979, 10289, 14958] plt.plot(years, gdp, color='green', marker='o', linestyle='solid') plt.show()