Reputation: 2328
I'm playing around ipython notebook and have a question.
I was trying to visualize the stock price and the trading volume in a graph. My code is:
import datetime
import pandas as pd
import pandas.io.data
from pandas import DataFrame
import matplotlib.pyplot as plt
from matplotlib import style
# skipping some code to get stock prices
ax1= plt.subplot(2,1,1)
ax1.plot(df.Close,label="sp500")
ax1.plot(ma,label='50MA')
plt.legend()
ax2=plt.subplot(2,1,2, sharex = ax1)
ax2.plot(df['H-L'],label='H-L')
plt.show()
And I succeeded plotting with ipython console. However, I cannot plot with ipython notebook. It seems like ipython notebook does nothing and python launcher popping up forever. Do anyone have ideas what's going on here?
Upvotes: 1
Views: 1254
Reputation: 8483
try adding this line before your plotting code
%matplotlib inline
It tells the ipython notebook to display plots inilne
Upvotes: 3