bars = volume_overlay(axMiddleVol, opens, closes, volumes, alpha=0.5) axMiddleVol.set_ylim((0, 3*max(vvolumes))) # use only a third of the viewlim if 1: ############### Lower axes ################# # make up two signals; I don't know what the signals are in real life # so I'll just illustrate the plotting stuff s1 = random_signal(len(vind), 10) s2 = random_signal(len(vind), 20) axLower.plot(vind, s1, color=purple) axLower.plot(vind, s2, color='k', linewidth=1.0) s3 = s2-s1 axLower.plot(vind, s3, color='#cccc99') # wheat bars = index_bar(axLower, s3, width=2, alpha=0.5, facecolor='#3087c7', edgecolor='#cccc99') axLower.yaxis.set_major_locator(MultipleLocator(5)) # now add some text left, height, top = 0.025, 0.06, 0.85 t = axLower.text(left, top, 'MACD(12,26,9) -0.26', fontsize=textsize, transform=axLower.transAxes) # make sure everyone has the same axes limits set(axLower.get_xticklabels(), 'rotation', 45, 'horizontalalignment', 'right', fontsize=8) # force all the axes to have the same x data limits
bars = volume_overlay(axMiddleVol, r.open, r.close, r.volume, alpha=0.5) # axMiddleVol.set_ylim(0, 3*r.volume.max()) # use only a third of the viewlim if 1: ############### Lower axes ################# # make up two signals; I don't know what the signals are in real life # so I'll just illustrate the plotting stuff s1 = random_signal(N, 10) s2 = random_signal(N, 20) axLower.plot(vind, s1, color=purple) axLower.plot(vind, s2, color="k", linewidth=1.0) s3 = s2 - s1 axLower.plot(vind, s3, color="#cccc99") # wheat bars = index_bar(axLower, s3, width=2, alpha=0.5, facecolor="#3087c7", edgecolor="#cccc99") axLower.yaxis.set_major_locator(MultipleLocator(5)) # now add some text left, height, top = 0.025, 0.06, 0.85 t = axLower.text(left, top, "MACD(12,26,9) -0.26", fontsize=textsize, transform=axLower.transAxes) # make sure everyone has the same axes limits setp(axLower.get_xticklabels(), "rotation", 45, "horizontalalignment", "right", fontsize=8) # force all the axes to have the same x data limits allAxes = (axUpper, axMiddle, axMiddleVol, axLower) xlim = 0, N for a in allAxes:
(0, 3 * max(vvolumes))) # use only a third of the viewlim if 1: ############### Lower axes ################# # make up two signals; I don't know what the signals are in real life # so I'll just illustrate the plotting stuff s1 = random_signal(len(vind), 10) s2 = random_signal(len(vind), 20) axLower.plot(vind, s1, color=purple) axLower.plot(vind, s2, color='k', linewidth=1.0) s3 = s2 - s1 axLower.plot(vind, s3, color='#cccc99') # wheat bars = index_bar(axLower, s3, width=2, alpha=0.5, facecolor='#3087c7', edgecolor='#cccc99') axLower.yaxis.set_major_locator(MultipleLocator(5)) # now add some text left, height, top = 0.025, 0.06, 0.85 t = axLower.text(left, top, 'MACD(12,26,9) -0.26', fontsize=textsize, transform=axLower.transAxes) # make sure everyone has the same axes limits