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

Log Message:
-----------
some cleanups to the volume overlay

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:52:00 UTC (rev 6991)
+++ trunk/matplotlib/examples/pylab_examples/finance_work2.py   2009-03-18 
16:07:19 UTC (rev 6992)
@@ -80,7 +80,7 @@
     up = seed[seed>=0].sum()/n
     down = -seed[seed<0].sum()/n
     rs = up/down
-    rsi = np.zeros_like(r.adj_close)
+    rsi = np.zeros_like(prices)
     rsi[:n] = 100. - 100./(1.+rs)
 
     for i in range(n, len(prices)):
@@ -129,6 +129,8 @@
 ax2t = ax2.twinx()
 ax3  = fig.add_axes(rect3, axisbg=axescolor, sharex=ax1)
 
+
+
 ### plot the relative strength indicator
 prices = r.adj_close
 rsi = relative_strength(prices)
@@ -176,14 +178,14 @@
 leg = ax2.legend(loc='center left', shadow=True, fancybox=True, prop=props)
 leg.get_frame().set_alpha(0.5)
 
-vmax = r.volume.max()/1e6
-poly = ax2t.fill_between(r.date, r.volume/1e6, 0, facecolor=fillcolor, 
label='Volume')
+
+volume = (r.close*r.volume)/1e6  # dollar volume in millions
+vmax = volume.max()
+poly = ax2t.fill_between(r.date, volume, 0, facecolor=fillcolor, 
label='Volume')
 ax2t.set_ylim(0, 5*vmax)
-ymax = np.int(vmax)
-yticks = [vmax/2., vmax]
-ax2t.set_yticks(yticks)
-ax2t.set_yticklabels(['%d M'%val for val in yticks])
+ax2t.set_yticks([])
 
+
 ### compute the MACD indicator
 fillcolor = 'darkslategrey'
 nslow = 26
@@ -220,7 +222,6 @@
             return ''
         else:
             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