MATLAB Answers

quiver arrows always appear below semitransparent layer

14 views (last 30 days)
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

Show 1 older comment
Joseph Cheng
Joseph Cheng on 16 Sep 2014
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%)
Chad Greene
Chad Greene on 16 Sep 2014
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

Sean de Wolski
Sean de Wolski on 16 Sep 2014
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

Chad Greene
Chad Greene on 16 Sep 2014
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)