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);

 채택된 답변

Chad Greene
Chad Greene 2014년 12월 31일
편집: Chad Greene 2014년 12월 31일

0 개 추천

Your image is plotted with x and y in units of pixels (from 1 to 1024), but your quiver plot spans the range 0.15 to 0.45. Replace your imagesc line with
imagesc(unique(X),unique(Y),img);

댓글 수: 2

soroush
soroush 2014년 12월 31일
Yes, changing the image range make it works finally! Thank you Chad!
Chad Greene
Chad Greene 2014년 12월 31일
You should verify that those pixels are properly registered. That is, make sure that each pixel in img is assigned to the proper x and y coordinates.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Chad Greene
Chad Greene 2014년 12월 31일

0 개 추천

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

Oops, that should be
quiver3(X,Y,ones(size(Velu)),Velu,Velw,zeros(size(Velu)) 'y','linewidth',2);

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Vector Fields에 대해 자세히 알아보기

질문:

2014년 12월 31일

댓글:

2014년 12월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by