/
usr
/
lib64
/
python2.6
/
site-packages
/
matplotlib
/
/usr/lib64/python2.6/site-packages/matplotlib
mkdir
upload
Name
Size
Mode
Actions
backends/
-
0755
rm
delaunay/
-
0755
rm
mpl-data/
-
0755
rm
numerix/
-
0755
rm
projections/
-
0755
rm
sphinxext/
-
0755
rm
afm.py
15089
0644
edit
dl
rm
afm.pyc
16959
0644
edit
dl
rm
afm.pyo
16959
0644
edit
dl
rm
artist.py
35623
0644
edit
dl
rm
artist.pyc
40326
0644
edit
dl
rm
artist.pyo
40326
0644
edit
dl
rm
axes.py
280089
0644
edit
dl
rm
axes.pyc
249396
0644
edit
dl
rm
axes.pyo
248284
0644
edit
dl
rm
axis.py
57354
0644
edit
dl
rm
axis.pyc
58973
0644
edit
dl
rm
axis.pyo
58666
0644
edit
dl
rm
backend_bases.py
72318
0644
edit
dl
rm
backend_bases.pyc
77967
0644
edit
dl
rm
backend_bases.pyo
77877
0644
edit
dl
rm
bezier.py
14917
0644
edit
dl
rm
bezier.pyc
13526
0644
edit
dl
rm
bezier.pyo
13526
0644
edit
dl
rm
blocking_input.py
13690
0644
edit
dl
rm
blocking_input.pyc
14346
0644
edit
dl
rm
blocking_input.pyo
14028
0644
edit
dl
rm
cbook.py
42756
0644
edit
dl
rm
cbook.pyc
56755
0644
edit
dl
rm
cbook.pyo
56529
0644
edit
dl
rm
cm.py
8098
0644
edit
dl
rm
cm.pyc
9772
0644
edit
dl
rm
cm.pyo
9772
0644
edit
dl
rm
collections.py
40784
0644
edit
dl
rm
collections.pyc
44006
0644
edit
dl
rm
collections.pyo
44006
0644
edit
dl
rm
colorbar.py
27456
0644
edit
dl
rm
colorbar.pyc
25497
0644
edit
dl
rm
colorbar.pyo
25497
0644
edit
dl
rm
colors.py
39110
0644
edit
dl
rm
colors.pyc
40079
0644
edit
dl
rm
colors.pyo
40079
0644
edit
dl
rm
contour.py
42895
0644
edit
dl
rm
contour.pyc
36099
0644
edit
dl
rm
contour.pyo
35937
0644
edit
dl
rm
dates.py
36007
0755
edit
dl
rm
dates.pyc
40017
0644
edit
dl
rm
dates.pyo
39953
0644
edit
dl
rm
dviread.py
32033
0644
edit
dl
rm
dviread.pyc
34682
0644
edit
dl
rm
dviread.pyo
34539
0644
edit
dl
rm
figure.py
41264
0644
edit
dl
rm
figure.pyc
42939
0644
edit
dl
rm
figure.pyo
42808
0644
edit
dl
rm
finance.py
20582
0644
edit
dl
rm
finance.pyc
18519
0644
edit
dl
rm
finance.pyo
18359
0644
edit
dl
rm
fontconfig_pattern.py
6429
0644
edit
dl
rm
fontconfig_pattern.pyc
6519
0644
edit
dl
rm
fontconfig_pattern.pyo
6519
0644
edit
dl
rm
font_manager.py
42653
0644
edit
dl
rm
font_manager.pyc
40456
0644
edit
dl
rm
font_manager.pyo
40456
0644
edit
dl
rm
ft2font.so
306168
0775
edit
dl
rm
hatch.py
6564
0644
edit
dl
rm
hatch.pyc
9120
0644
edit
dl
rm
hatch.pyo
9120
0644
edit
dl
rm
image.py
31540
0644
edit
dl
rm
image.pyc
33042
0644
edit
dl
rm
image.pyo
32996
0644
edit
dl
rm
legend.py
32302
0644
edit
dl
rm
legend.pyc
23551
0644
edit
dl
rm
legend.pyo
23378
0644
edit
dl
rm
lines.py
54685
0644
edit
dl
rm
lines.pyc
56431
0644
edit
dl
rm
lines.pyo
56326
0644
edit
dl
rm
mathtext.py
102009
0644
edit
dl
rm
mathtext.pyc
103067
0644
edit
dl
rm
mathtext.pyo
102679
0644
edit
dl
rm
mlab.py
94294
0644
edit
dl
rm
mlab.pyc
100004
0644
edit
dl
rm
mlab.pyo
99824
0644
edit
dl
rm
mpl.py
785
0644
edit
dl
rm
mpl.pyc
1176
0644
edit
dl
rm
mpl.pyo
1176
0644
edit
dl
rm
nxutils.so
9512
0775
edit
dl
rm
offsetbox.py
29807
0644
edit
dl
rm
offsetbox.pyc
33889
0644
edit
dl
rm
offsetbox.pyo
33834
0644
edit
dl
rm
patches.py
128485
0644
edit
dl
rm
patches.pyc
130148
0644
edit
dl
rm
patches.pyo
130010
0644
edit
dl
rm
path.py
21765
0644
edit
dl
rm
path.pyc
21174
0644
edit
dl
rm
path.pyo
20954
0644
edit
dl
rm
pylab.py
10981
0644
edit
dl
rm
pylab.pyc
12399
0644
edit
dl
rm
pylab.pyo
12399
0644
edit
dl
rm
pyparsing.py
143924
0644
edit
dl
rm
pyparsing.pyc
146737
0644
edit
dl
rm
pyparsing.pyo
146737
0644
edit
dl
rm
pyplot.py
82468
0644
edit
dl
rm
pyplot.pyc
80279
0644
edit
dl
rm
pyplot.pyo
80279
0644
edit
dl
rm
quiver.py
37540
0644
edit
dl
rm
quiver.pyc
33788
0644
edit
dl
rm
quiver.pyo
33788
0644
edit
dl
rm
rcsetup.py
23434
0644
edit
dl
rm
rcsetup.pyc
21119
0644
edit
dl
rm
rcsetup.pyo
20949
0644
edit
dl
rm
scale.py
14233
0644
edit
dl
rm
scale.pyc
19474
0644
edit
dl
rm
scale.pyo
19474
0644
edit
dl
rm
spines.py
12684
0644
edit
dl
rm
spines.pyc
11636
0644
edit
dl
rm
spines.pyo
11209
0644
edit
dl
rm
table.py
16828
0644
edit
dl
rm
table.pyc
16931
0644
edit
dl
rm
table.pyo
16780
0644
edit
dl
rm
texmanager.py
22464
0644
edit
dl
rm
texmanager.pyc
19962
0644
edit
dl
rm
texmanager.pyo
19962
0644
edit
dl
rm
text.py
59822
0644
edit
dl
rm
text.pyc
59240
0644
edit
dl
rm
text.pyo
59240
0644
edit
dl
rm
ticker.py
40428
0644
edit
dl
rm
ticker.pyc
50461
0644
edit
dl
rm
ticker.pyo
50325
0644
edit
dl
rm
tight_bbox.py
3655
0644
edit
dl
rm
tight_bbox.pyc
4066
0644
edit
dl
rm
tight_bbox.pyo
4066
0644
edit
dl
rm
transforms.py
75387
0644
edit
dl
rm
transforms.pyc
89611
0644
edit
dl
rm
transforms.pyo
88702
0644
edit
dl
rm
ttconv.so
65360
0775
edit
dl
rm
type1font.py
11537
0644
edit
dl
rm
type1font.pyc
11256
0644
edit
dl
rm
type1font.pyo
11256
0644
edit
dl
rm
units.py
4976
0644
edit
dl
rm
units.pyc
5775
0644
edit
dl
rm
units.pyo
5775
0644
edit
dl
rm
widgets.py
40833
0644
edit
dl
rm
widgets.pyc
42568
0644
edit
dl
rm
widgets.pyo
42382
0644
edit
dl
rm
windowing.py
454
0644
edit
dl
rm
windowing.pyc
1283
0644
edit
dl
rm
windowing.pyo
1283
0644
edit
dl
rm
_cm.py
370414
0644
edit
dl
rm
_cm.pyc
103042
0644
edit
dl
rm
_cm.pyo
103042
0644
edit
dl
rm
_cntr.so
21184
0775
edit
dl
rm
_delaunay.so
61120
0775
edit
dl
rm
_image.so
282248
0775
edit
dl
rm
_mathtext_data.py
57990
0644
edit
dl
rm
_mathtext_data.pyc
63787
0644
edit
dl
rm
_mathtext_data.pyo
63787
0644
edit
dl
rm
_path.so
279992
0775
edit
dl
rm
_png.so
156472
0775
edit
dl
rm
_pylab_helpers.py
2715
0644
edit
dl
rm
_pylab_helpers.pyc
3708
0644
edit
dl
rm
_pylab_helpers.pyo
3708
0644
edit
dl
rm
__init__.py
28972
0644
edit
dl
rm
__init__.pyc
28980
0644
edit
dl
rm
__init__.pyo
28926
0644
edit
dl
rm
Edit:
/usr/lib64/python2.6/site-packages/matplotlib/finance.py
(20582B)
""" A collection of modules for collecting, analyzing and plotting financial data. User contributions welcome! """ #from __future__ import division import os, time, warnings from urllib2 import urlopen try: from hashlib import md5 except ImportError: from md5 import md5 #Deprecated in 2.5 try: import datetime except ImportError: raise ImportError('The finance module requires datetime support (python2.3)') import numpy as np from matplotlib import verbose, get_configdir from dates import date2num from matplotlib.cbook import Bunch from matplotlib.collections import LineCollection, PolyCollection from matplotlib.colors import colorConverter from lines import Line2D, TICKLEFT, TICKRIGHT from patches import Rectangle from matplotlib.transforms import Affine2D configdir = get_configdir() cachedir = os.path.join(configdir, 'finance.cache') def parse_yahoo_historical(fh, asobject=False, adjusted=True): """ Parse the historical data in file handle fh from yahoo finance and return results as a list of d, open, close, high, low, volume where d is a floating poing representation of date, as returned by date2num if adjust=True, use adjusted prices """ results = [] lines = fh.readlines() datefmt = None for line in lines[1:]: vals = line.split(',') if len(vals)!=7: continue datestr = vals[0] if datefmt is None: try: datefmt = '%Y-%m-%d' dt = datetime.date(*time.strptime(datestr, datefmt)[:3]) except ValueError: datefmt = '%d-%b-%y' # Old Yahoo--cached file? dt = datetime.date(*time.strptime(datestr, datefmt)[:3]) d = date2num(dt) open, high, low, close = [float(val) for val in vals[1:5]] volume = int(vals[5]) if adjusted: aclose = float(vals[6]) m = aclose/close open *= m high *= m low *= m close = aclose results.append((d, open, close, high, low, volume)) results.reverse() if asobject: if len(results)==0: return None else: date, open, close, high, low, volume = map(np.asarray, zip(*results)) return Bunch(date=date, open=open, close=close, high=high, low=low, volume=volume) else: return results def fetch_historical_yahoo(ticker, date1, date2, cachename=None): """ Fetch historical data for ticker between date1 and date2. date1 and date2 are datetime instances Ex: fh = fetch_historical_yahoo('^GSPC', d1, d2) cachename is the name of the local file cache. If None, will default to the md5 hash or the url (which incorporates the ticker and date range) a file handle is returned """ ticker = ticker.upper() d1 = (date1.month-1, date1.day, date1.year) d2 = (date2.month-1, date2.day, date2.year) urlFmt = 'http://table.finance.yahoo.com/table.csv?a=%d&b=%d&c=%d&d=%d&e=%d&f=%d&s=%s&y=0&g=d&ignore=.csv' url = urlFmt % (d1[0], d1[1], d1[2], d2[0], d2[1], d2[2], ticker) if cachename is None: cachename = os.path.join(cachedir, md5(url).hexdigest()) if os.path.exists(cachename): fh = file(cachename) verbose.report('Using cachefile %s for %s'%(cachename, ticker)) else: if not os.path.isdir(cachedir): os.mkdir(cachedir) urlfh = urlopen(url) fh = file(cachename, 'w') fh.write(urlfh.read()) fh.close() verbose.report('Saved %s data to cache file %s'%(ticker, cachename)) fh = file(cachename, 'r') return fh def quotes_historical_yahoo(ticker, date1, date2, asobject=False, adjusted=True, cachename=None): """ Get historical data for ticker between date1 and date2. date1 and date2 are datetime instances results are a list of tuples (d, open, close, high, low, volume) where d is a floating poing representation of date, as returned by date2num if asobject is True, the return val is an object with attrs date, open, close, high, low, volume, which are equal length arrays if adjust=True, use adjusted prices Ex: sp = f.quotes_historical_yahoo('^GSPC', d1, d2, asobject=True, adjusted=True) returns = (sp.open[1:] - sp.open[:-1])/sp.open[1:] [n,bins,patches] = hist(returns, 100) mu = mean(returns) sigma = std(returns) x = normpdf(bins, mu, sigma) plot(bins, x, color='red', lw=2) cachename is the name of the local file cache. If None, will default to the md5 hash or the url (which incorporates the ticker and date range) """ fh = fetch_historical_yahoo(ticker, date1, date2, cachename) try: ret = parse_yahoo_historical(fh, asobject, adjusted) except IOError, exc: warnings.warn('urlopen() failure\n' + url + '\n' + exc.strerror[1]) return None return ret def plot_day_summary(ax, quotes, ticksize=3, colorup='k', colordown='r', ): """ quotes is a list of (time, open, close, high, low, ...) tuples Represent the time, open, close, high, low as a vertical line ranging from low to high. The left tick is the open and the right tick is the close. time must be in float date format - see date2num ax : an Axes instance to plot to ticksize : open/close tick marker in points colorup : the color of the lines where close >= open colordown : the color of the lines where close < open return value is a list of lines added """ lines = [] for q in quotes: t, open, close, high, low = q[:5] if close>=open : color = colorup else : color = colordown vline = Line2D( xdata=(t, t), ydata=(low, high), color=color, antialiased=False, # no need to antialias vert lines ) oline = Line2D( xdata=(t, t), ydata=(open, open), color=color, antialiased=False, marker=TICKLEFT, markersize=ticksize, ) cline = Line2D( xdata=(t, t), ydata=(close, close), color=color, antialiased=False, markersize=ticksize, marker=TICKRIGHT) lines.extend((vline, oline, cline)) ax.add_line(vline) ax.add_line(oline) ax.add_line(cline) ax.autoscale_view() return lines def candlestick(ax, quotes, width=0.2, colorup='k', colordown='r', alpha=1.0): """ quotes is a list of (time, open, close, high, low, ...) tuples. As long as the first 5 elements of the tuples are these values, the tuple can be as long as you want (eg it may store volume). time must be in float days format - see date2num Plot the time, open, close, high, low as a vertical line ranging from low to high. Use a rectangular bar to represent the open-close span. If close >= open, use colorup to color the bar, otherwise use colordown ax : an Axes instance to plot to width : fraction of a day for the rectangle width colorup : the color of the rectangle where close >= open colordown : the color of the rectangle where close < open alpha : the rectangle alpha level return value is lines, patches where lines is a list of lines added and patches is a list of the rectangle patches added """ OFFSET = width/2.0 lines = [] patches = [] for q in quotes: t, open, close, high, low = q[:5] if close>=open : color = colorup lower = open height = close-open else : color = colordown lower = close height = open-close vline = Line2D( xdata=(t, t), ydata=(low, high), color='k', linewidth=0.5, antialiased=True, ) rect = Rectangle( xy = (t-OFFSET, lower), width = width, height = height, facecolor = color, edgecolor = color, ) rect.set_alpha(alpha) lines.append(vline) patches.append(rect) ax.add_line(vline) ax.add_patch(rect) ax.autoscale_view() return lines, patches def plot_day_summary2(ax, opens, closes, highs, lows, ticksize=4, colorup='k', colordown='r', ): """ Represent the time, open, close, high, low as a vertical line ranging from low to high. The left tick is the open and the right tick is the close. ax : an Axes instance to plot to ticksize : size of open and close ticks in points colorup : the color of the lines where close >= open colordown : the color of the lines where close < open return value is a list of lines added """ # note this code assumes if any value open, close, low, high is # missing they all are missing rangeSegments = [ ((i, low), (i, high)) for i, low, high in zip(xrange(len(lows)), lows, highs) if low != -1 ] # the ticks will be from ticksize to 0 in points at the origin and # we'll translate these to the i, close location openSegments = [ ((-ticksize, 0), (0, 0)) ] # the ticks will be from 0 to ticksize in points at the origin and # we'll translate these to the i, close location closeSegments = [ ((0, 0), (ticksize, 0)) ] offsetsOpen = [ (i, open) for i, open in zip(xrange(len(opens)), opens) if open != -1 ] offsetsClose = [ (i, close) for i, close in zip(xrange(len(closes)), closes) if close != -1 ] scale = ax.figure.dpi * (1.0/72.0) tickTransform = Affine2D().scale(scale, 0.0) r,g,b = colorConverter.to_rgb(colorup) colorup = r,g,b,1 r,g,b = colorConverter.to_rgb(colordown) colordown = r,g,b,1 colord = { True : colorup, False : colordown, } colors = [colord[open<close] for open, close in zip(opens, closes) if open!=-1 and close !=-1] assert(len(rangeSegments)==len(offsetsOpen)) assert(len(offsetsOpen)==len(offsetsClose)) assert(len(offsetsClose)==len(colors)) useAA = 0, # use tuple here lw = 1, # and here rangeCollection = LineCollection(rangeSegments, colors = colors, linewidths = lw, antialiaseds = useAA, ) openCollection = LineCollection(openSegments, colors = colors, antialiaseds = useAA, linewidths = lw, offsets = offsetsOpen, transOffset = ax.transData, ) openCollection.set_transform(tickTransform) closeCollection = LineCollection(closeSegments, colors = colors, antialiaseds = useAA, linewidths = lw, offsets = offsetsClose, transOffset = ax.transData, ) closeCollection.set_transform(tickTransform) minpy, 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) ax.update_datalim(corners) ax.autoscale_view() # add these last ax.add_collection(rangeCollection) ax.add_collection(openCollection) ax.add_collection(closeCollection) return rangeCollection, openCollection, closeCollection def candlestick2(ax, opens, closes, highs, lows, width=4, colorup='k', colordown='r', alpha=0.75, ): """ Represent the open, close as a bar line and high low range as a vertical line. ax : an Axes instance to plot to width : the bar width in points colorup : the color of the lines where close >= open colordown : the color of the lines where close < open alpha : bar transparency return value is lineCollection, barCollection """ # note this code assumes if any value open, close, low, high is # missing they all are missing 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 ] rangeSegments = [ ((i, low), (i, high)) for i, low, high in zip(xrange(len(lows)), lows, highs) if low != -1 ] r,g,b = colorConverter.to_rgb(colorup) colorup = r,g,b,alpha r,g,b = colorConverter.to_rgb(colordown) colordown = r,g,b,alpha colord = { True : colorup, False : colordown, } colors = [colord[open<close] for open, close in zip(opens, closes) if open!=-1 and close !=-1] assert(len(barVerts)==len(rangeSegments)) useAA = 0, # use tuple here lw = 0.5, # and here rangeCollection = LineCollection(rangeSegments, colors = ( (0,0,0,1), ), linewidths = lw, antialiaseds = useAA, ) barCollection = PolyCollection(barVerts, facecolors = colors, edgecolors = ( (0,0,0,1), ), antialiaseds = useAA, linewidths = lw, ) 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 = (minx, miny), (maxx, maxy) ax.update_datalim(corners) ax.autoscale_view() # add these last ax.add_collection(barCollection) ax.add_collection(rangeCollection) return rangeCollection, barCollection def volume_overlay(ax, opens, closes, volumes, colorup='k', colordown='r', width=4, alpha=1.0): """ Add a volume overlay to the current axes. The opens and closes are used to determine the color of the bar. -1 is missing. If a value is missing on one it must be missing on all ax : an Axes instance to plot to width : the bar width in points colorup : the color of the lines where close >= open colordown : the color of the lines where close < open alpha : bar transparency """ r,g,b = colorConverter.to_rgb(colorup) colorup = r,g,b,alpha r,g,b = colorConverter.to_rgb(colordown) colordown = r,g,b,alpha colord = { True : colorup, False : colordown, } colors = [colord[open<close] for open, close in zip(opens, closes) if open!=-1 and close !=-1] 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 ] barCollection = PolyCollection(bars, facecolors = colors, edgecolors = ( (0,0,0,1), ), antialiaseds = (0,), linewidths = (0.5,), ) corners = (0, 0), (len(bars), max(volumes)) ax.update_datalim(corners) ax.autoscale_view() # add these last return barCollection def volume_overlay2(ax, closes, volumes, colorup='k', colordown='r', width=4, alpha=1.0): """ Add a volume overlay to the current axes. The closes are used to determine the color of the bar. -1 is missing. If a value is missing on one it must be missing on all ax : an Axes instance to plot to width : the bar width in points colorup : the color of the lines where close >= open colordown : the color of the lines where close < open alpha : bar transparency nb: first point is not displayed - it is used only for choosing the right color """ return volume_overlay(ax,closes[:-1],closes[1:],volumes[1:],colorup,colordown,width,alpha) def volume_overlay3(ax, quotes, colorup='k', colordown='r', width=4, alpha=1.0): """ Add a volume overlay to the current axes. quotes is a list of (d, open, close, high, low, volume) and close-open is used to determine the color of the bar kwarg width : the bar width in points colorup : the color of the lines where close1 >= close0 colordown : the color of the lines where close1 < close0 alpha : bar transparency """ r,g,b = colorConverter.to_rgb(colorup) colorup = r,g,b,alpha r,g,b = colorConverter.to_rgb(colordown) colordown = r,g,b,alpha colord = { True : colorup, False : colordown, } dates, opens, closes, highs, lows, volumes = zip(*quotes) colors = [colord[close1>=close0] for close0, close1 in zip(closes[:-1], closes[1:]) if close0!=-1 and close1 !=-1] colors.insert(0,colord[closes[0]>=opens[0]]) right = width/2.0 left = -width/2.0 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.height / ax.viewLim.height barTransform = Affine2D().scale(sx,sy) dates = [d for d, open, close, high, low, volume in quotes] offsetsBars = [(d, 0) for d in dates] useAA = 0, # use tuple here lw = 0.5, # and here barCollection = PolyCollection(bars, facecolors = colors, edgecolors = ( (0,0,0,1), ), antialiaseds = useAA, linewidths = lw, offsets = offsetsBars, transOffset = ax.transData, ) barCollection.set_transform(barTransform) minpy, maxx = (min(dates), max(dates)) miny = 0 maxy = max([volume for d, open, close, high, low, volume in quotes]) corners = (minpy, miny), (maxx, maxy) ax.update_datalim(corners) #print 'datalim', ax.dataLim.get_bounds() #print 'viewlim', ax.viewLim.get_bounds() ax.add_collection(barCollection) ax.autoscale_view() return barCollection def index_bar(ax, vals, facecolor='b', edgecolor='l', width=4, alpha=1.0, ): """ Add a bar collection graph with height vals (-1 is missing). ax : an Axes instance to plot to width : the bar width in points alpha : bar transparency """ facecolors = (colorConverter.to_rgba(facecolor, alpha),) edgecolors = (colorConverter.to_rgba(edgecolor, alpha),) right = width/2.0 left = -width/2.0 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.height / ax.viewLim.height barTransform = Affine2D().scale(sx,sy) offsetsBars = [ (i, 0) for i,v in enumerate(vals) if v != -1 ] barCollection = PolyCollection(bars, facecolors = facecolors, edgecolors = edgecolors, 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 vals if v!=-1]) corners = (minpy, miny), (maxx, maxy) ax.update_datalim(corners) ax.autoscale_view() # add these last ax.add_collection(barCollection) return barCollection
Save
cmd:
run