Revision: 5330
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5330&view=rev
Author: jdh2358
Date: 2008-05-30 12:24:37 -0700 (Fri, 30 May 2008)
Log Message:
-----------
fixed some finance mod bugs
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/finance.py
Modified: trunk/matplotlib/lib/matplotlib/finance.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/finance.py 2008-05-30 19:21:56 UTC (rev
5329)
+++ trunk/matplotlib/lib/matplotlib/finance.py 2008-05-30 19:24:37 UTC (rev
5330)
@@ -335,7 +335,7 @@
scale = ax.figure.dpi * (1.0/72.0)
- tickTransform = Affine2D().scaled(scale, 0.0)
+ tickTransform = Affine2D().scale(scale, 0.0)
r,g,b = colorConverter.to_rgb(colorup)
colorup = r,g,b,1
@@ -411,24 +411,14 @@
# note this code assumes if any value open, close, low, high is
# missing they all are missing
- right = width/2.0
- left = -width/2.0
+
+ delta = width/2.
+ barVerts = [ ( (i-delta, open), (i-delta, close), (i+delta, close),
(i+delta, open) ) for i, open, close in zip(xrange(len(opens)), opens, closes)
if open != -1 and close!=-1 ]
- barVerts = [ ( (left, 0), (left, close-open), (right, close-open), (right,
0) ) for open, close in zip(opens, closes) if open != -1 and close!=-1 ]
-
rangeSegments = [ ((i, low), (i, high)) for i, low, high in
zip(xrange(len(lows)), lows, highs) if low != -1 ]
- offsetsBars = [ (i, open) for i,open in zip(xrange(len(opens)), opens) if
open != -1 ]
-
- sx = ax.figure.dpi * (1.0/72.0) # scale for points
- sy = (ax.bbox.ur().y() - ax.bbox.ll().y()) / (ax.viewLim.ur().y() -
ax.viewLim.ll().y())
-
- barTransform = Affine2D().scaled(sx,sy)
-
-
-
r,g,b = colorConverter.to_rgb(colorup)
colorup = r,g,b,alpha
r,g,b = colorConverter.to_rgb(colordown)
@@ -440,8 +430,6 @@
assert(len(barVerts)==len(rangeSegments))
- assert(len(rangeSegments)==len(offsetsBars))
- assert(len(offsetsBars)==len(colors))
useAA = 0, # use tuple here
lw = 0.5, # and here
@@ -457,19 +445,13 @@
edgecolors = ( (0,0,0,1), ),
antialiaseds = useAA,
linewidths = lw,
- offsets = offsetsBars,
- transOffset = ax.transData,
)
- barCollection.set_transform(barTransform)
-
-
-
- minpy, maxx = (0, len(rangeSegments))
+ minx, maxx = 0, len(rangeSegments)
miny = min([low for low in lows if low !=-1])
maxy = max([high for high in highs if high != -1])
- corners = (minpy, miny), (maxx, maxy)
+ corners = (minx, miny), (maxx, maxy)
ax.update_datalim(corners)
ax.autoscale_view()
@@ -504,38 +486,17 @@
}
colors = [colord[open<close] for open, close in zip(opens, closes) if
open!=-1 and close !=-1]
- right = width/2.0
- left = -width/2.0
+ delta = width/2.
+ bars = [ ( (i-delta, 0), (i-delta, v), (i+delta, v), (i+delta, 0)) for i,
v in enumerate(volumes) if v != -1 ]
-
- bars = [ ( (left, 0), (left, v), (right, v), (right, 0)) for v in volumes
if v != -1 ]
-
- sx = ax.figure.dpi * (1.0/72.0) # scale for points
- sy = (ax.bbox.ur().y() - ax.bbox.ll().y()) / (ax.viewLim.ur().y() -
ax.viewLim.ll().y())
-
- barTransform = Affine2D().scaled(sx,sy)
-
- offsetsBars = [ (i, 0) for i,v in enumerate(volumes) if v != -1 ]
-
barCollection = PolyCollection(bars,
facecolors = colors,
edgecolors = ( (0,0,0,1), ),
antialiaseds = (0,),
linewidths = (0.5,),
- offsets = offsetsBars,
- transOffset = ax.transData,
)
- barCollection.set_transform(barTransform)
-
-
-
-
-
- minpy, maxx = (0, len(offsetsBars))
- miny = 0
- maxy = max([v for v in volumes if v!=-1])
- corners = (minpy, miny), (maxx, maxy)
+ corners = (0, 0), (len(bars), max(volumes))
ax.update_datalim(corners)
ax.autoscale_view()
@@ -601,9 +562,9 @@
bars = [ ( (left, 0), (left, volume), (right, volume), (right, 0)) for d,
open, close, high, low, volume in quotes]
sx = ax.figure.dpi * (1.0/72.0) # scale for points
- sy = (ax.bbox.ur().y() - ax.bbox.ll().y()) / (ax.viewLim.ur().y() -
ax.viewLim.ll().y())
+ sy = ax.bbox.height / ax.viewLim.height
- barTransform = Affine2D().scaled(sx,sy)
+ barTransform = Affine2D().scale(sx,sy)
dates = [d for d, open, close, high, low, volume in quotes]
offsetsBars = [(d, 0) for d in dates]
@@ -661,9 +622,9 @@
bars = [ ( (left, 0), (left, v), (right, v), (right, 0)) for v in vals if
v != -1 ]
sx = ax.figure.dpi * (1.0/72.0) # scale for points
- sy = (ax.bbox.ur().y() - ax.bbox.ll().y()) / (ax.viewLim.ur().y() -
ax.viewLim.ll().y())
+ sy = ax.bbox.height / ax.viewLim.height
- barTransform = Affine2D().scaled(sx,sy)
+ barTransform = Affine2D().scale(sx,sy)
offsetsBars = [ (i, 0) for i,v in enumerate(vals) if v != -1 ]
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins