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?
try adding this line before your plotting code
%matplotlib inline
It tells the ipython notebook to display plots inilne
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.