quiver arrows always appear below semitransparent layer

I am attempting to plot quiver arrows on top of a semitransparent pcolor layer. However, the arrows only appear below the semitransparent layer. It does not seem to depend on the order in which I plot the layers, and uistack has no effect. How can I get the arrows to appear on top?
figure('renderer','opengl')
imagesc(A); hold on
colormap(gray(256))
freezeColors;
% Overlay semitransparent ice speed:
h = pcolor(x,y,speed)
colormap(jet)
shading interp
set(h,'facealpha',.4)
% overlay velocity vectors:
hq = quiver(x,y,vx,vy,'k');

4 Comments

odd i can't seem to recreate your results. i created this to test it out.
figure('renderer','opengl')
base = imread('circuit.tif');
imagesc(base);hold on
colormap(gray(256))
freezeColors;
trans = peaks;
trans = imresize(trans,size(base)/2);
trans = pcolor(20*trans);
colormap(jet)
shading interp, set(trans,'faceAlpha',.4);
[x,y] = meshgrid(1:5:272,1:5:280);
u = cos(x).*y;
v = sin(x).*y;
quiver(x,y(end:-1:1,:),u,v,'k')
does it still happen?
Still happens. I have R2012b on a Mac OSX 10.8.5.
odd... still can't reproduce it and i jumped all way back to 2011a. I am using windows so maybe that's it? The only thing i can think next is changing the children order as changing the renderer to either zbuffer wouldn't let you have transparency?
get(gca,'Children') and set(gca,'Children',%reordered%)
Strange. Reordering children doesn't work either. Perhaps it's a Mac/OpenGL issue, and indeed, I need OpenGL for the transparency. Thanks for trying, Joseph.

Sign in to comment.

 Accepted Answer

Probably an OpenGL issue but one thing you can do is use quiver3 with z set to some positive amount greater than the max of surface. Set v component to zero as well.

1 Comment

Good thinking, Sean. This workaround is not perfect, but it definitely gets the job done.
That's set the w component that needs to be set to zero.
In Joseph's example, his quiver line can be replaced with
quiver3(x,y(end:-1:1,:),ones(size(x)),u,v,zeros(size(x)),'k')

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!