python - add vertical line intersecting 3 different axes in a figure in matplotlib -


i have plot eeg data of 3 different channels in graph. plot of of them in 1 figure seperated horozintal lines. x axis common channels.

i can using add_axes. want draw vertical line intersecting these axes. m not able it.

currently, sample code this.

from pylab import figure, show, setp numpy import sin, cos, exp, pi, arange  t = arange(0.0, 2.0, 0.01) s1 = sin(2*pi*t) s2 = exp(-t) s3 = 200*t    fig = figure() t = arange(0.0, 2.0, 0.01)  yprops = dict(rotation=0,               horizontalalignment='right',               verticalalignment='center',               x=-0.1)  axprops = dict(yticks=[])  ax1 =fig.add_axes([0.1, 0.5, 0.8, 0.2], **axprops) ax1.plot(t, s1) ax1.set_ylabel('s1', **yprops)  axprops['sharex'] = ax1 #axprops['sharey'] = ax1 # force x axes remain in register, toolbar navigation ax2 = fig.add_axes([0.1, 0.3, 0.8, 0.2], **axprops)  ax2.plot(t, s2) ax2.set_ylabel('s2', **yprops)  ax3 = fig.add_axes([0.1, 0.1, 0.8, 0.2], **axprops) ax3.plot(t, s3) ax3.set_ylabel('s3', **yprops)     # turn off x ticklabels lower axes ax in ax1, ax2:     setp(ax.get_xticklabels(), visible=false)  show() 

i want final image 1 below. in current output, can same graph without green vertical line.

enter image description here

can 1 please ??? dont want use subplots , dont want add axvline each axes.

thank u, thothadri

use

vl_lst = [a.axvline(x_pos, color='g', lw=3, linestyle='-') in [ax1, ax2, ax3]] 

to update each frame:

new_x = x v in vl_lst:     v.set_xdata(new_x) 

axvline doc


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -