python - Charts are not matching up one is centered the other is left justified in matplotlib -
im trying make stock chart have. candle stick chart of price overlapping moving averg. on button bar chart of vol.
the issue candle stick chart , vol chart centered, while moving averg right justified. when moving averg chart overlaps candle stick, not lines on x axes. (update: added 2 more charts @ buttom use plot methed, left justified to, seems al charts using plot left justified while res centered)
i use ax2v = ax2.twinx() moving averg on same graph candle stick. ax2 candle stick, ax2v moving averg.
i did , stack overflow , saw 1 said add align='center', io tried thatv follows ax2v.plot(bit.slowmacd[macdstart:], align='center') , got error saying typeerror: there no line2d property "align"
the code snippet candle stick , moving averg chart
#### set uo candle stick chart x = 0 y = len(bit.listall) ohlc = [] while x < y: append_me = bit.listall[x], bit.openprice[x], bit.biggestprice[x], bit.smallestprice[x], bit.closeprice[x], bit.vol[x] ohlc.append(append_me) x+=1 candlestick_ohlc(ax2, ohlc[macdstart:], width=0.4, colorup='#77d879', colordown='#db3f3f')
ax2v.plot(bit.slowmacd[macdstart:], align='center')
the complete program def drawgraph():
####################################################################### # set chart postions , title fig = plt.figure() ax1 = plt.subplot2grid((6,1), (0,0), rowspan=1, colspan=1) plt.title("test") plt.ylabel('h-l') ax2 = plt.subplot2grid((6,1), (1,0), rowspan=4, colspan=1, sharex=ax1) plt.ylabel('price') ax2v = ax2.twinx() #ax2v2 = ax2.twinx() ax3 = plt.subplot2grid((6,1), (5,0), rowspan=1, colspan=1, sharex=ax1) plt.ylabel('mavgs') ###################################################################### ###################################################################### ### set uo candle stick chart x = 0 y = len(bit.listall) ohlc = [] while x < y: append_me = bit.listall[x], bit.openprice[x], bit.biggestprice[x], bit.smallestprice[x], bit.closeprice[x], bit.vol[x] ohlc.append(append_me) x+=1 candlestick_ohlc(ax2, ohlc[macdstart:], width=0.4, colorup='#77d879', colordown='#db3f3f') ax2v.plot(bit.slowmacd[macdstart:], align='center') #ax2v.plot(bit.fastmacd[macdstart:], , align='center') ##################################################################### ##################################################################### ### vol chart ax3.fill_between(bit.listall,0, bit.vol, facecolor='#0079a3') plt.show() ax2v.plot(bit.slowmacd[macdstart:]) #ax2v.plot(bit.fastmacd[macdstart:], , align='center') #####################################################################