필터 지우기
필터 지우기

Locking figure axis for quiver loop

조회 수: 1 (최근 30일)
Alexandr Lozak
Alexandr Lozak 2019년 8월 19일
편집: Alexandr Lozak 2019년 8월 19일
I have code for figure with superimposition of temperature image and quiver plot in loop.
But it image shifts every loop if side arrows exceed length of 1 pixel. How i can lock image or scale arrows?
[x,y]=meshgrid(1:1:31,1:1:38);
k=4997;
cnt=0;
heat_conductivity=28;
d=4;
for i=1:k
[dTdx,dTdy] = gradient(V(:,:,i));
u(:,:,i) = -heat_conductivity*dTdx;
v(:,:,i) = -heat_conductivity*dTdy;
end
f=figure('Renderer', 'painters', 'Position', [10 10 600 620]);
ax=gca;
ax.XLim = [1 38];
ax.YLim = [1 31];
%f.WindowState='maximized';
for i=1:k
%figure
imagesc(V(:,:,i));
axis tight
hold on
q=quiver(x,y,v(:,:,i),u(:,:,i))
%q.AutoScale='on';
q.AutoScaleFactor=0.9;
q.ShowArrowHead='on';
%q.MaxHeadSize= 1;
q.AlignVertexCenters='on';
q.LineWidth=0.5;
q.MaxHeadSize=1;
q.Color='black';
%axis tight
colormap jet
colorbar
caxis([26 35])
cnt=i;
title(cnt);
pause (0.1)
clf;
end
untitled.png
untitled2.png
  댓글 수: 4
Alexandr Lozak
Alexandr Lozak 2019년 8월 19일
편집: Alexandr Lozak 2019년 8월 19일
Problem was with quiver itself and arrows. Thats why adding X,Y limits after quiver function helped. Hope it will be helpful for others
f=figure('Renderer', 'painters', 'Position', [10 10 600 620]);
% ax=gca;
% ax.XLimMode='manual';
% ax.YLimMode='manual';
% ax.XLim = [1 38];
% ax.YLim = [1 31];
%f.WindowState='maximized';
for i=1:k
%figure
imagesc(V(:,:,i));
axis tight
hold on
q=quiver(x,y,v(:,:,i),u(:,:,i))
%q.AutoScale='on';
q.AutoScaleFactor=0.9;
q.ShowArrowHead='on';
%q.MaxHeadSize= 1;
q.AlignVertexCenters='on';
q.LineWidth=0.5;
q.MaxHeadSize=1;
q.Color='black';
%axis tight
xlim manual
ylim manual
axis ([1 31 1 38 ])
colormap jet
colorbar
caxis([26 35])
cnt=i;
title(cnt);
pause (0.1)
clf;
end
Adam
Adam 2019년 8월 19일
axis tight
in the loop is what caused the original behaviour, by fitting tightly around each new set of quivers

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by