Quiver over pcolor problem

I have a pcolor plot plotted as such:
h2 = pcolor(lat(187,185:280),1:71,temp);
and I'd like to plot a quiver plot ontop of it. When I plot the quiver plot as:
q = quiver(wtemp(1:2:96,1:2:71),utemp(1:2:96,1:2:71),'k');
after having plotted h2, the arrows are readable and appear appropriate. However, the axes are stretched to 36 on x-axis and 48 on y-axis (the size of my w and u arrays), making my pcolor plot all but invisible on this scale. If I change the Xdata and Ydata of quiver to represent the actual limits of the pcolor plot (1-71 on the x-axis and [35.5362 35.9539] on the y-axis) as such:
q = quiver(wtemp(1:2:96,1:2:71),utemp(1:2:96,1:2:71),'k','XData',1:2:71,'Ydata', lat(187,185:2:280));
my arrows are now very very large. When I scale them using 'Autoscale' (I have to go as low as 0.005), they just appear as straight lines with no arrows and no longer in the right direction. I've tried making a meshgrid with the XData and Ydata arrays, and using those as such:
[xx yy] = meshgrid(1:2:71,lat(187,185:2:280));
q = quiver(xx,yy,wtemp(1:2:96,1:2:71),utemp(1:2:96,1:2:71),'k');
and the result is the same as setting XData and YData manually.
Any help to remedy this would be appreciated.

댓글 수: 2

Sean de Wolski
Sean de Wolski 2013년 9월 12일
편집: Sean de Wolski 2013년 9월 12일
Hi Larissa,
It would really help if you could provide sample data in the form of something we can generate that would emulate your data or by posting it somewhere so we can download it. Graphics things are much easier to resolve with reproduction steps.
This problem can be reproduced by running this code. Note that it doesn't have a pcolor plotted, because that's not necessary to reproduce the exact problem. The pcolor plot has nothing to do with the problem, it just provides a frame of reference for why I need to change the plotted locations of the quiver barbs. :
i = 1;
wm2 = rand(400,400,71,12);
Um2 = rand(400,400,71,12);
lon = 96+2*rand(400,400);
lat = 35 + rand(400,400);
figure(1)
ax2 = axes;
set(ax2,'OuterPosition',[0.05 0.05 0.15 0.7])
wtemp = wm2(187,185:280,:,i);
utemp = Um2(187,185:280,:,i);
wtemp = reshape(wtemp,96,71);
utemp = reshape(utemp,96,71);
y = 1:4:96;
x = 1:4:71;
[xx yy] = meshgrid(x,lat(187,185:4:280));
subplot(1,2,1)
quiver(wtemp(y,x),utemp(y,x),'k')
subplot(1,2,2)
quiver(xx,yy,wtemp(y,x),utemp(y,x),'k')

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

답변 (0개)

카테고리

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

질문:

2013년 9월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by