Skip to content

Commit 48ad7aa

Browse files
committed
replaced matplotlib function finance.quotes_historical_yahoo() (deprecated as of matplotlib 1.4.x) with finance.quotes_historical_yahoo_ochl(), enabling the example to work for the latest version of matplotlib (1.5.0).
updated import statement to support users that are on matplotlib versions older than 1.4.x fixed typo in import. fixed error with method invocation.
1 parent e17c4de commit 48ad7aa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

examples/applications/plot_stock_market.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,12 @@
6868

6969
import numpy as np
7070
import matplotlib.pyplot as plt
71-
from matplotlib import finance
71+
try:
72+
from matplotlib.finance import quotes_historical_yahoo_ochl
73+
except ImportError:
74+
# quotes_historical_yahoo_ochl was named quotes_historical_yahoo before matplotlib 1.4
75+
from matplotlib.finance import quotes_historical_yahoo as quotes_historical_yahoo_ochl
7276
from matplotlib.collections import LineCollection
73-
7477
from sklearn import cluster, covariance, manifold
7578

7679
###############################################################################
@@ -146,7 +149,7 @@
146149

147150
symbols, names = np.array(list(symbol_dict.items())).T
148151

149-
quotes = [finance.quotes_historical_yahoo(symbol, d1, d2, asobject=True)
152+
quotes = [quotes_historical_yahoo_ochl(symbol, d1, d2, asobject=True)
150153
for symbol in symbols]
151154

152155
open = np.array([q.open for q in quotes]).astype(np.float)

0 commit comments

Comments
 (0)