python - Heatmap with varying y axis -
i create visualization upper part of this image. essentially, heatmap each point in time has fixed number of components these components anchored y axis means of labels (that can supply) rather first index in heatmap's matrix.
i aware of pcolormesh, not seem give me y-axis functionality seek.
lastly, open solutions in r, although python option much preferable.
i not sure if understand meaning correctly, looking @ picture have linked, might best off roll-your-own solution.
first, need create array heatmap values have on row each label , 1 column each time slot. fill array nans , write whatever heatmap values have correct positions.
then need trick imshow
bit scale , show image in correct way.
for example:
# create masked data a=cumsum(random.random((20,200)), axis=0) x,y=meshgrid(arange(a.shape[1]),arange(a.shape[0])) a[y<15*sin(x/50.)]=nan a[y>10+15*sin(x/50.)]=nan # draw image along curves imshow(a,interpolation='nearest',origin='lower',extent=[-2,2,0,3]) xd = linspace(-2, 2, 200) yd = 1 + .1 * cumsum(random.random(200)-.5) plot(xd, yd,'w',linewidth=3) plot(xd, yd,'k',linewidth=1) axis('normal')
gives:
Comments
Post a Comment