Superimpose a quiver plot on top of a picture
Show older comments
Hi,
I want to superimpose vector field on top of a TIFF figure!! my vector fields are in '.struct' format, but apparently the vectors are always appear below the figure!! Does anyone know why this happen? & how to superimpose a quiver plot onto a figure?! Here is my code: close all clear all
U=load('VelU - 5m1p2s1.mat');
W=load('VelW - 5m1p2s1.mat')
img = imread('fc2_save_2014-11-17-213936-0000.tif');
imagesc(img);
hold on;
X = U(1,1).x(20:1:64,20:1:64);
Y = U(1,1).y(20:1:64,20:1:64);
Velu = U(1,1).u(20:1:64,20:1:64);
Velw = W(1,1).w(20:1:64,20:1:64);
quiver(X,Y,Velu,Velw, 'y','linewidth',2);
Accepted Answer
More Answers (1)
Chad Greene
on 31 Dec 2014
Sometimes stacking gets a little confused, especially depending on the renderer and Matlab distribution. You can try
h = quiver(X,Y,Velu,Velw, 'y','linewidth',2);
uistack(h,'top')
or place the arrows at a higher z value with quiver3 like this:
quiver3(X,Y,ones(Velu),Velu,Velw,zeros(Velu) 'y','linewidth',2);
1 Comment
Chad Greene
on 31 Dec 2014
Oops, that should be
quiver3(X,Y,ones(size(Velu)),Velu,Velw,zeros(size(Velu)) 'y','linewidth',2);
Categories
Find more on Vector Fields in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!