Overlapping quiver plot at same scale

21 ビュー (過去 30 日間)
Jessica Hiscocks
Jessica Hiscocks 2017 年 4 月 3 日
回答済み: Jessica Hiscocks 2017 年 4 月 3 日
I'm overlaying two quiver plots using the following code, but the scale between the two is not identical I plotted the data as one quiver plot (all in black, code not shown) and then split it into positive and negative values (plot contains red), at which point the red arrows scaled up. How can I force these to maintain the same scale? Basically my end goal is to colour all negative values red on the plot.
figure;
h1=quiver(xt,yt,quiverXt,-1*quiverYt,2,'filled','k');
hold on
h2=quiver(xc,yc,quiverXc,-1*quiverYc,2,'filled','r');
hold off

回答 (1 件)

Jessica Hiscocks
Jessica Hiscocks 2017 年 4 月 3 日
solved it based on another answer previously posted. The key is basically you have to set scale to zero and then scale both quivers after plotting.
figure;
h1=quiver(xt,yt,quiverXt,-1*quiverYt,0,'filled','k');
hold on
h2=quiver(xc,yc,quiverXc,-1*quiverYc,0,'filled','r');
hold off
scale=5;
hU1 = get(h1,'UData');
hV1 = get(h1,'VData');
set(h1,'UData',scale*hU1,'VData',scale*hV1)
hU2 = get(h2,'UData');
hV2 = get(h2,'VData');
set(h2,'UData',scale*hU2,'VData',scale*hV2)

カテゴリ

Help Center および File ExchangeVector Fields についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by