From: Thomas B. <tho...@ya...> - 2004-06-22 14:49:28
|
Hello, When I run the following script, the ganged candlestick plots appear as expected. However, there is a second plot behind but sticking out (with different x and y axes) that shouldn't be there. Am I not doing this correctly? I can't see where in the code below I am mistakenly creating two plots that overlap, or is there a bug with ganged candlesticks? Tks vm, Tom ----------------------------------------------------------- from matplotlib.matlab import * from matplotlib.dates import MONDAY from matplotlib.finance import candlestick from matplotlib.ticker import WeekdayLocator, DayLocator, DateFormatter series1 = [] series1.append((1041379200, 100.0, 100.5, 99.0, 102.0)) series1.append((1041465600, 101.0, 101.5, 98.0, 103.0)) series1.append((1041552000, 103.0, 104.0, 103.0, 106.0)) series1.append((1041638400, 105.0, 102.5, 102.0, 108.0)) series2 = [] series2.append((1041379200, 1000.0, 1000.5, 999.0, 1002.0)) series2.append((1041465600, 1001.0, 1001.5, 998.0, 1003.0)) series2.append((1041552000, 1003.0, 1004.0, 1003.0, 1006.0)) series2.append((1041638400, 1005.0, 1002.5, 1002.0, 1008.0)) series3 = [] series3.append((1041379200, 10000.0, 10000.5, 9999.0, 10002.0)) series3.append((1041465600, 10001.0, 10001.5, 9998.0, 10003.0)) series3.append((1041552000, 10003.0, 10004.0, 10003.0, 10006.0)) series3.append((1041638400, 10005.0, 10002.5, 10002.0, 10008.0)) sub = subplot(1, 1, 1) ax1 = axes([0.1, 0.1, 0.8, 0.25]) # lower ax2 = axes([0.1, 0.35, 0.8, 0.25]) # middle ax2.set_xticklabels([]) ax3 = axes([0.1, 0.6, 0.8, 0.25]) # upper ax3.set_xticklabels([]) candlestick(ax1, series1, width=0.6) candlestick(ax2, series2, width=0.6) candlestick(ax3, series3, width=0.6) mondays = WeekdayLocator(MONDAY) days = DayLocator() fmt = DateFormatter('%b %d') ax1.xaxis.set_major_locator(mondays) ax1.xaxis.set_major_formatter(fmt) ax1.xaxis.set_minor_locator(days) ax1.autoscale_view() show() |