Revision: 6989
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6989&view=rev
Author:   jdh2358
Date:     2009-03-18 15:45:07 +0000 (Wed, 18 Mar 2009)

Log Message:
-----------
fixed high/low for adjustment factor

Modified Paths:
--------------
    trunk/matplotlib/examples/pylab_examples/finance_work2.py

Modified: trunk/matplotlib/examples/pylab_examples/finance_work2.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/finance_work2.py   2009-03-18 
15:22:41 UTC (rev 6988)
+++ trunk/matplotlib/examples/pylab_examples/finance_work2.py   2009-03-18 
15:45:07 UTC (rev 6989)
@@ -63,6 +63,7 @@
 
     weights /= weights.sum()
 
+
     a =  np.convolve(x, weights, mode='full')[:len(x)]
     a[:n] = a[n]
     return a
@@ -146,11 +147,15 @@
 ax1.set_title('%s daily'%ticker)
 
 ### plot the price and volume data
+dx = r.adj_close - r.close
+low = r.low + dx
+high = r.high + dx
+
 deltas = np.zeros_like(prices)
 deltas[1:] = np.diff(prices)
 up = deltas>0
-ax2.vlines(r.date[up], r.low[up], r.high[up], color='black', 
label='_nolegend_')
-ax2.vlines(r.date[~up], r.low[~up], r.high[~up], color='black', 
label='_nolegend_')
+ax2.vlines(r.date[up], low[up], high[up], color='black', label='_nolegend_')
+ax2.vlines(r.date[~up], low[~up], high[~up], color='black', label='_nolegend_')
 ma20 = moving_average(prices, 20, type='simple')
 ma200 = moving_average(prices, 200, type='simple')
 
@@ -207,6 +212,7 @@
 
     ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d')
 
+
 class PriceFormatter(mticker.FormatStrFormatter):
     'suppress the lowest tick label to prevent overlap'
     def __call__(self, x, pos=None):
@@ -216,6 +222,7 @@
             return mticker.FormatStrFormatter.__call__(self, x, pos=None)
 
 ax2.yaxis.set_major_formatter(PriceFormatter('%d'))
+
 plt.show()
 
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to